Überarbeitungsverlauf[Zurück]
Klicke auf Einblenden/Ausblenden von Überarbeitungen 3
Mehr Themen + Formatierung + Tipps zum Verfassen

06 Jun '18, 11:29

saputello's gravatar image

saputello
11.1k174365

pgfplots: x-Achse mit Strings

Hallo, ich Ich versuche gerade ein Säulendiagramm zu erstellen. Die gesamte x-Achse besteht dabei aus Strings (Namen von magn. Kernen). Die y-Achse enthält das Volumen (float). Wie sage ich pgfplots, `pgfplots`, dass die x-Achse mit dem String "ETD 29/" usw. beschriftet werden soll? Später soll das in eine CSV Datei stehen. Wie muss die CSV aussehen? Bisher sieht sie so aus: x,y ETD 29/16/10,9.60 ETD 34/17/11,13.21 ETD 39/20/13,19.92 ETD 44/22/15,29.96 ETD 49/25/16,40.34 PQ 20/20,5.80 PQ 26/20,10.15 PQ 26/25,12.47 PQ 32/20,14.43 PQ 32/30,21.37 Muss ich dann pgfplot sagen, dass die Trennung mit einem Komma erfolgt? Hier das Minimalbeispiel für das "String-Problem": \documentclass{scrartcl} \usepackage{amsmath} \usepackage[normalem]{ulem} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usepgfplotslibrary{dateplot} \usepackage{subcaption} \usepackage{filecontents} \begin{filecontents}{datensuperfein.dat} x y ETD 29/16/10 9.60 ETD 34/17/11 13.21 ETD 39/20/13 19.92 ETD 44/22/15 29.96 ETD 49/25/16 40.34 PQ 20/20 5.80 PQ 26/20 10.15 PQ 26/25 12.47 PQ 32/20 14.43 PQ 32/30 21.37 \end{filecontents} \begin{document} \begin{figure} \centering \begin{tikzpicture} \begin{axis}[ %width=\linewidth, % Scale the plot to \linewidth grid=major, % Display a grid grid style={dashed,gray!30}, % Set the style xlabel=X Axis, ylabel=Y Axis, legend style={at={(0.5,-0.2)},anchor=north}, % Put the legend below the plot x tick label style={rotate=90,anchor=east} % Display labels sideways ] \addplot+[ybar] table [x index=0, y expr=\thisrowno{1}] {datensuperfein.dat}; \legend{Plot} \end{axis} \end{tikzpicture} \caption{Caption} \end{figure} \end{document}
Klicke auf Einblenden/Ausblenden von Überarbeitungen 2

06 Jun '18, 11:08

SF6's gravatar image

SF6
15953440

pgfplots: x-Achse mit Strings

Hallo, ich versuche gerade ein Säulendiagramm zu erstellen. Die gesamte x-Achse besteht dabei aus Strings (Namen von magn. Kernen). Die y-Achse enthält das Volumen (float). Wie sage ich pgfplots, dass die x-Achse mit dem String "ETD 29/" usw. beschriftet werden soll? Später soll das in eine CSV Datei stehen. Wie muss die CSV aussehen? Bisher sieht sie so aus: x,y ETD 29/16/10,9.60 ETD 34/17/11,13.21 ETD 39/20/13,19.92 ETD 44/22/15,29.96 ETD 49/25/16,40.34 PQ 20/20,5.80 PQ 26/20,10.15 PQ 26/25,12.47 PQ 32/20,14.43 PQ 32/30,21.37 Muss ich dann pgfplot sagen, dass die Trennung mit einem Komma erfolgt? Hier das Minimalbeispiel für das "String-Problem": \documentclass{scrartcl} \usepackage{amsmath} \usepackage[normalem]{ulem} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usetikzlibrary{patterns} \usepgfplotslibrary{fillbetween} \usepgfplotslibrary{dateplot} \usepackage{subcaption} \usepackage{filecontents} \begin{filecontents}{datensuperfein.dat} x y ETD 29/16/10 9.60 ETD 34/17/11 13.21 ETD 39/20/13 19.92 ETD 44/22/15 29.96 ETD 49/25/16 40.34 PQ 20/20 5.80 PQ 26/20 10.15 PQ 26/25 12.47 PQ 32/20 14.43 PQ 32/30 21.37 \end{filecontents} \begin{document} \begin{figure} \centering \begin{tikzpicture} \begin{axis}[ %width=\linewidth, % Scale the plot to \linewidth grid=major, % Display a grid grid style={dashed,gray!30}, % Set the style xlabel=X Axis, ylabel=Y Axis, legend style={at={(0.5,-0.2)},anchor=north}, % Put the legend below the plot x tick label style={rotate=90,anchor=east} % Display labels sideways ] \addplot+[ybar] table [x index=0, y expr=\thisrowno{1}] {datensuperfein.dat}; \legend{Plot} \end{axis} \end{tikzpicture} \caption{Caption} \end{figure} \end{document}
Klicke auf Einblenden/Ausblenden von Überarbeitungen 1

06 Jun '18, 11:07

SF6's gravatar image

SF6
15953440