I have a sample with countries and data. I would like to have a "comb" graph to show the years covered in the sample for each country.
My data is like this :
#########################################################
country,year
AUT,1998
AUT,1999
AUT,2000
GER,1999
GER,2000
GER,2001
GER,2002
FRA,2000
FRA,2001
FRA,2002
FRA,2003
#########################################################
I would like to get something like :
AUT ---------------
FRA -------------------
GER --------------------
1998|1999|2000|2001|2002|2003
Data is coming from another software and I can manipulate it before passing it on to LaTeX. For instance:
- I can order countries, years, etc. before passing it on to LaTeX.
- Currently some country-years are duplicated in the data but I can compress it to unique occurrences of country-years
- I could also create a new dataset of the form [country,minyear,maxyear] if that's easier to manipulate with
pgfplots.
I tried a MWE but of course the addplot command is bogus and yields an error:
\documentclass{minimal}
\usepackage{filecontents}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.7}
\usepackage{pgfplotstable}
\begin{filecontents}{CountryYears.csv}
#########################################################
country,year
AUT,1998
AUT,1999
AUT,2000
GER,1999
GER,2000
GER,2001
GER,2002
FRA,2000
FRA,2001
FRA,2002
FRA,2003
#########################################################
\end{filecontents}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\pgfplotstableread[col sep=comma]{CountryYears.csv}\loadeddata
\addplot table[y=year,x=country,ybar] {\loadeddata}; % Plotting the data
\end{axis}
\end{tikzpicture}
\end{document}

