I am trying to load data from a table which looks like below and use the 'label' column for xticklabels.
idx,label,value
1,20040101_20050108.rotation.summary, 19.470949839091155
2,20040101_20050115.rotation.summary, 3.2633743485078925
3,20040101_20050122.rotation.summary, 2.6505513476912275
4,20040101_20050129.rotation.summary, 1.8865512077042033
5,20040101_20050205.rotation.summary, 2.2793107344143277
I have around 600 rows and when I used xtick=data with xticklabels from table={\mydata}{1} I am getting a plot like below.
So I tried to use xticklabel customization like below with \pgfplotstablegetelem.
\begin{tikzpicture}
\begin{axis}[
xmax=573,
xticklabel={$\pgfplotstablegetelem{\tick}{1}\of{\mydata}$},
xticklabel style={rotate=90, anchor=east}]
\addplot[mark=none] table [
x index={0},
y index={2}] {\mydata};
\end{axis}
\end{tikzpicture}
But what I got was following:
Please let me know if anyone has any ideas to fix this.
Update 1
I figured out that I should use \pgfplotsretval to get the element value and updated my plot to reflect that like below
...
xticklabel={$\pgfplotstablegetelem{\tick}{label}\of{\mydata}\pgfplotsretval$},
...
But the label still has prefix added to the beginning of each label like .000000002004010120061209.rotation.summary.
Update 2
I found the solution. xticklabel should be something like below.
{
\pgfmathparse{int(round(\tick))}
\pgfplotstablegetelem{\pgfmathresult}{[index]1}\of{\stresscculogerr}\pgfplotsretval
}


\tickmade prefix go away. – Milinda Pathirage May 01 '16 at 21:54