Seite 1 von 1

Achsenskalierung umdrehen [pgfplots]

Verfasst: Sa 9. Feb 2013, 14:31
von kilian
Hallo,
weis jemand wie ich eine Diagramm-Achse absteigend beschrifte. Also die x-Achse dann von der 30 zur 0 läuft.
Da ich mir Daten über eine *.txt Datei einlese und der Wertebereich der Achse immer verschieden ist müsste die Definition alg. gültig sein.
%

\documentclass[a4paper,twoside,openright,12pt]{scrbook}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.7}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
% warning: the '%' signs are necessary (?)
scaled y ticks=manual:{$+65\,535$}{%
\pgfmathparse{#1-65535}%
},
yticklabel style={
/pgf/number format/fixed,
/pgf/number format/precision=1},
]
\addplot coordinates {
(0, 65535)
(13, 65535)
(14, 65536)
(15, 65537)
(30, 65537)
};
\end{axis}
\end{tikzpicture}

\end{document}
Grüße Kilian

Verfasst: Sa 9. Feb 2013, 20:51
von Epllus
Meinst du so etwas?:
\documentclass[a4paper,twoside,openright,12pt]{scrbook} 
\usepackage{pgfplots} 
\pgfplotsset{width=7cm,compat=1.7} 

\begin{document} 

\begin{tikzpicture} 
\begin{axis}[ 
% warning: the '%' signs are necessary (?) 
scaled y ticks=manual:{$+65\,535$}{% 
\pgfmathparse{#1-65535}% 
}, 
yticklabel style={ 
/pgf/number format/fixed, 
/pgf/number format/precision=1}, 
x dir=reverse
] 
\addplot coordinates { 
(0, 65535) 
(13, 65535) 
(14, 65536) 
(15, 65537) 
(30, 65537) 
}; 
\end{axis} 
\end{tikzpicture} 

\end{document}
Hoffe es hilft
Epllus

Verfasst: So 10. Feb 2013, 13:17
von kilian
Ja
x dir=reverse
war genau das was ich gesucht habe. Das hilft nicht nur das löst :D .
Perfekt und vielen Danke!!!
Kilian