I have something like this:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots,pgfplotstable}
\usetikzlibrary{pgfplots.dateplot}
\pgfplotsset{compat=newest} % Allows to place the legend below plot
\pgfplotsset{general plot/.style={
date coordinates in=x,
date ZERO=2019-12-31,
width=37cm,
height=20cm,
xlabel=x,
ylabel=y,
table/create on use/d/.style={create col/expr={\pgfmathaccuma + \thisrow{y}}},
}
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[general plot]
\addplot
table[x=Date, y=d, col sep=space] {data.csv};
\addlegendentry{legend}
\end{axis}
\end{tikzpicture}
\end{document}
With my data.csv file looking like this:
Date y
2020-03-20 1
2020-03-19 2
2020-03-18 3
2020-03-17 4
2020-03-16 5
2020-03-15 6
2020-03-14 7
2020-03-13 8
2020-03-12 9
2020-03-11 10
I get a curve that goes down (of course since the new column is created on the given table). What I want now, is to sort the values in the table (with the date as key) first and create the new column afterwards.
Anyone out there how to do this?