so I'm trying to plot a csv file using pgfplots. The csv file looks like this but with more data:
Here is the download link for the csv: https://datawrapper.dwcdn.net/NDCZf/4/
I tried using the code from this post pgfplot: plot non-numerical data from CSV file . But I end up with something like this:
Here is the code:
\documentclass[ngerman]{scrbook}
\usepackage[utf8]{inputenc}
\input{../shared/twp-cfg}
\begin{document}
\pgfplotstableread[col sep=comma]{../shared/data.csv}\datatable
\begin{tikzpicture}
\begin{axis}[
ybar,
xtick=data,
xticklabels from table={\datatable}{X},
xticklabel style={rotate=90,anchor=base,yshift=0.82cm},
]
\addplot table [col sep=comma, x expr=\coordindex, y=Terawatt-Hours(TWh)] {../shared/data.csv};
\end{axis}
\end{tikzpicture}
\end{document}
Is there a way to fix this and make the plot wider? I'm new to LaTeX, so any help would be welcome. Thanks.



data.csvand minimum code from\documentclass{...to\end{document}– Simon Dispa Feb 19 '22 at 21:11data.csv(the link only shows a graph) andtwp-cfg– Simon Dispa Feb 19 '22 at 21:38