von markusv » Do 14. Jan 2021, 14:11
Möchte den "erzieherischen Wink" des fehlenden Minimalbeispiel nicht konterkarieren, aber anbei ein Beispiel, welches allerdings sicherlich noch nicht ausgereift ist:
\documentclass[border=5mm]{standalone}
\usepackage[svgnames]{xcolor}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
font={\sffamily},
ybar stacked,
ymin=0,
xmin=.5,
xmax=2.5,
xtick=data,
ytick={0,100,...,800},
xticklabels={End 2003,End 2006},
axis x line=none,
axis y line*=left,
ymajorgrids,
major grid style={line width=.2pt,draw=gray!50},
bar width=16mm,
reverse legend,
legend style={
at={(1.05,.5)},anchor=west,
legend cell align=left,
draw=none}
]
\addplot[blue,fill] coordinates
{(1,130) (2,320)};\addlegendentry{Flat Carbon Steel}
\addplot[Aquamarine,fill] coordinates
{(1,100) (2,150)};\addlegendentry{Purchasing}
\addplot[Cyan,fill] coordinates
{(1,100) (2,150)};\addlegendentry{Stainless Steel}
\addplot[LightGrey,fill] coordinates
{(1,100) (2,150)};\addlegendentry{Commercial and gereral expenses}
\end{axis}
\end{tikzpicture}
\end{document}
Möchte den "erzieherischen Wink" des fehlenden [MWE][/MWE] nicht konterkarieren, aber anbei ein Beispiel, welches allerdings sicherlich noch nicht ausgereift ist:[code]\documentclass[border=5mm]{standalone}
\usepackage[svgnames]{xcolor}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
font={\sffamily},
ybar stacked,
ymin=0,
xmin=.5,
xmax=2.5,
xtick=data,
ytick={0,100,...,800},
xticklabels={End 2003,End 2006},
axis x line=none,
axis y line*=left,
ymajorgrids,
major grid style={line width=.2pt,draw=gray!50},
bar width=16mm,
reverse legend,
legend style={
at={(1.05,.5)},anchor=west,
legend cell align=left,
draw=none}
]
\addplot[blue,fill] coordinates
{(1,130) (2,320)};\addlegendentry{Flat Carbon Steel}
\addplot[Aquamarine,fill] coordinates
{(1,100) (2,150)};\addlegendentry{Purchasing}
\addplot[Cyan,fill] coordinates
{(1,100) (2,150)};\addlegendentry{Stainless Steel}
\addplot[LightGrey,fill] coordinates
{(1,100) (2,150)};\addlegendentry{Commercial and gereral expenses}
\end{axis}
\end{tikzpicture}
\end{document}[/code]