Gestapeltes Säulendiagramm

Tabellen und Grafiken erstellen und anordnen


Rolli
Forum-Guru
Forum-Guru
Beiträge: 382
Registriert: Mi 15. Feb 2017, 08:50
Wohnort: Mittelfranken

Beitrag von Rolli »

Ändere
enlargelimits=0.15,
in
enlargelimits=0.10,
und male die Abszissenachse nochmals drüber.

Gruß vom Rolli

Rolli
Forum-Guru
Forum-Guru
Beiträge: 382
Registriert: Mi 15. Feb 2017, 08:50
Wohnort: Mittelfranken

Beitrag von Rolli »

Bitteschön:
\documentclass{scrartcl}
\usepackage{selinput}% https://texwelt.de/wissen/fragen/5546
\SelectInputMappings{
   adieresis={ä},
   germandbls={ß}
}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}
\usepackage{pgfplots}
\usepackage{showframe}

\pgfplotsset{
   compat=newest,
   /pgf/number format/use comma
}

\begin{document}
\listoffigures
\begin{center}
\begin{tikzpicture}[scale=.8]
\begin{axis}[
   width=12cm,
   axis y line=left,
   axis x line=bottom,
   ybar stacked,
   bar width=15pt,
   nodes near coords={\pgfmathprintnumber\pgfplotspointmeta\,\%},% Prozentzeichen ergänzt
   nodes near coords style={color=black},% Farbe der Schrift in den Balken
   enlargelimits=0.125,
   legend pos=outer north east,
   xtick style={draw=none},
   xticklabel={\pgfmathparse{\tick*100}\pgfmathprintnumber{\pgfmathresult}\%xxx},
   ymajorgrids,
   legend cell align=left,
   ylabel={\%},
   ytick={0,4,8,12,16,20},
   yticklabels={0\,\%,4\,\%,8\,\%,12\,\%,16\,\%,20\,\%},
   symbolic x coords={Basel II, 2013, 2014, 2015, 
      2016, 2017, 2018,2019},
   xtick=data,
]
%Blau Hartes Kernkapital,
\addplot+[draw=yellow, fill=yellow!30] plot coordinates {(Basel II,2) (2013,3.5)
   (2014,4) (2015,4.5) (2016,4.5) (2017,4.5) (2018,4.5) (2019,4.5)};

%erweitertes Kernkapital
\addplot+ plot coordinates {(Basel II,2) (2013,1)
   (2014,1.5) (2015,1.5) (2016,1.5) (2017,1.5) (2018,1.5) (2019,1.5)};

\addplot+ plot coordinates {(Basel II,4) (2013,3.5)
   (2014,2.5) (2015,2) (2016,2) (2017,2) (2018,2) (2019,2)};

%grau
\addplot+ plot coordinates {(Basel II,0) (2013,0)
   (2014,0) (2015,0) (2016,0.625) (2017,1.25) (2018,1.875)(2019,2.5)};

\addplot+ plot coordinates {(Basel II,0) (2013,0)
   (2014,0) (2015,0) (2016,0.6) (2017,1.3) (2018,1.9)(2019,2.5)};

\addplot+ plot coordinates {(Basel II,0) (2013,3)
   (2014,5) (2015,5) (2016,5) (2017,5) (2018,5)(2019,5)};


\legend{Hartes Kernkapital,erweitertes Kernkapital, Ergänzungskapital, 
   Kapitalerhaltungspuffer, Antizyklischer Kapitalpuffer,Systemische Kapitalpuffer}

\end{axis}
\draw [very thin] (0,0) -- (10,0);
\end{tikzpicture}
\captionof{figure}{Beschriftung}
\end{center}
\end{document}
Gruß vom Rolli

Antworten