As the MWE shows, the separator for every 1000th count was defined empty (for the lack of a better term) since the first column represents the year.
So running the MWE does not work, since pgfplots does not parse numbers with ,
as 1000 separators/indicators. I'm a bit confused and would like to reassure if this is the right thought: should every figure in the input file then just consist of numbers and no other character whatsoever?
data01.csv
2006;50,000
2007;100,000
data02.csv
2006;100000
2007;150000
MWE
\documentclass[
a4paper
]{scrartcl}
\usepackage{
tikz,
pgfplots,
amsmath
}
\usepackage[T1]{fontenc}
\usepackage{
lmodern,
textcomp
}
\usetikzlibrary{calc,trees,shadows,positioning,arrows,chains,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols,patterns,intersections}
\pgfdeclarelayer{background layer}
\pgfdeclarelayer{foreground layer}
\pgfsetlayers{background layer,main,foreground layer}
\def\parsedate#1-#2!{%
\pgfmathparse{#1+1/12*(1#2-101)}%
}
\begin{document}
\begin{center}
\begin{tikzpicture}
\begin{semilogyaxis}[
%height=7cm,
%width=14cm,
%axis lines*=left,
ymin=0,
xmin=2006,
xlabel={abc},
ylabel={def},
enlargelimits=upper,
/pgf/number format/1000 sep={},
legend style={at={(0.6,1.2)}},
stack plots=y,
%legend columns=4,
legend cell align=left,
every axis x label/.style={
at={(ticklabel* cs:1.02)},
anchor=west,
},
every axis y label/.style={
at={(ticklabel* cs:1.02)},
anchor=south,
},
]
\addplot [mark=*, mark indices={1,6}] table [col sep=semicolon] {data01.csv}
node[pos=0, above right=5pt, fill=white]{257,000}
node[pos=1, anchor=south, yshift=3pt, fill=white]{244,862};
\addlegendentry{Text 1}
\addplot [mark=x, mark indices={1,7}] table [col sep=semicolon] {data02.csv}
node[pos=0, above right=5pt, fill=white]{2.000}
node[pos=1, above right=5pt, fill=white]{1.998};
\addlegendentry{Text 2}
\end{semilogyaxis}
\end{tikzpicture}
\end{center}
\end{document}
Best Answer
You should only be applying this 1000's separator definition to the printing of your tick marks on the x axis. For this use
x tick label style
or equivalentlyxticklabel style
. In any case this is not affecting reading from the input file. For that, you can tellpgf
to ignore commas via anignore chars
option:I have added a
compat
setting topgfplots
, and replacedymin=0
byymin=10
, both to suppress warnings.