Achsenskalierung umdrehen [pgfplots]

Tabellen und Grafiken erstellen und anordnen


kilian
Forum-Newbie
Forum-Newbie
Beiträge: 6
Registriert: Mi 6. Feb 2013, 16:13

Achsenskalierung umdrehen [pgfplots]

Beitrag 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

Epllus
Forum-Guru
Forum-Guru
Beiträge: 470
Registriert: So 23. Sep 2012, 17:31

Beitrag 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

kilian
Forum-Newbie
Forum-Newbie
Beiträge: 6
Registriert: Mi 6. Feb 2013, 16:13

Beitrag 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

Antworten