How do I plot economic type data that has a time series element from a CSV? For example:

Date GDP
2009 6
2010 3
2011 4
2012 7

See for example section 3.3 in the pgfplots manual.

There are a lot of of examples in the manual, so it's not just a handy reference, sometimes scrolling through it looking at examples can be a way of finding answers.

output of code

% remove comma in xticklabels
xticklabel style={/pgf/number format/set thousands separator={}},
% one tick every year
xtick distance=1
\addplot table {
Date GDP
2009 6
2010 3
2011 4
2012 7
% if you have the file, you can do
% \addplot table {datafile.csv};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.