Zwei Diagramme auf einer Linie: funktioniert nicht
Verfasst: Mi 8. Nov 2017, 18:36
Hallo
Ich würde diese Diagramme gerne nebeneinander nehmen (auf einer Linie).
Aber irgendwie klappt es nicht.
Was muss ich ändern?
Ich würde diese Diagramme gerne nebeneinander nehmen (auf einer Linie).
Aber irgendwie klappt es nicht.
Was muss ich ändern?
\documentclass[12pt,a4paper]{report} \usepackage{pgfplotstable} \pgfplotsset{compat=newest} \usetikzlibrary{arrows.meta} \definecolor{myorange}{rgb}{1,0.3,0} \usepackage{caption} \usepackage[ngerman]{babel} \usepackage[utf8]{inputenc} \begin{document} \noindent \begin{flushleft} \pgfplotsset{ width=7.5cm,% height=4cm,% scale only axis, axis lines=left, x axis line style={|[left]-|[right]}, y axis line style={|[right]-|[left]}, ylabel=Anzahl, ymin=0,ymax=6, ytick={2,4,6,8,10}, ymajorgrids, xlabel=Antworten, xtick={0,...,3}, xticklabels={A,B,C}, xticklabel style={anchor=east,rotate=45,align=center}, ybar=0pt, /pgf/bar width=1.8cm,% enlarge x limits={abs=1.4cm},% nodes near coords } \begin{minipage}[t]{0.55\textwidth} \begin{tikzpicture} \pgfplotstableread{ Antworten I {A} 5 {B} 2 {C} 3 }{\data}; \begin{axis} \addplot[fill=myorange]table[x expr=\coordindex,y=I]{\data}; \end{axis} \end{tikzpicture} \captionof{figure}{Text} \end{minipage} \end{flushleft} \qquad \begin{flushleft} \pgfplotsset{ width=3.5cm,% height=4cm,% scale only axis, axis lines=left, x axis line style={|[left]-|[right]}, y axis line style={|[right]-|[left]}, ylabel=Anzahl, ymin=0,ymax=8, ytick={2,4,6,8}, ymajorgrids, xlabel=Antworten, xtick={0,...,2}, xticklabels={Ja,Nein}, xticklabel style={anchor=east,rotate=45,align=center}, ybar=0pt, /pgf/bar width=1cm,% enlarge x limits={abs=1cm},% nodes near coords } \begin{minipage}[t]{0.3\textwidth} \begin{tikzpicture} \pgfplotstableread{ Antworten I {Ja} 7 {Nein} 3 }{\data}; \begin{axis} \addplot[fill=myorange]table[x expr=\coordindex,y=I]{\data}; \end{axis} \end{tikzpicture} \captionof{figure}{Text} \end{minipage} \end{flushleft} \end{document}