I am trying to multiply the x coordinates of a plot by a certain factor.
Section 4.3.4 from the pgfplots manual and this thread explain how to use mathematical expressions with data tables using /pgfplots/table/x expr={expression}.
My data are provided to pgfplots as coordinates lists, is there a mean to use it this way or should I switch my data to tables?
EDIT: here's my code
\begin{tikzpicture}
\tikzstyle{every node}=[font=\scriptsize]
\begin{axis}[
ybar=5pt,
enlarge x limits=0.15,
legend pos=north east,
legend style={legend columns=1},
ylabel={Number of fruits daily eaten},
symbolic x coords={1,2,3,4,5},
bar width=5pt,
ymin=1,
ymax=20,
xticklabels={orange,apple,banana,strawberry,tomato},
error bars/.cd,
yminorgrids=true,
ymajorgrids=true,
nodes near coords,
every node near coord/.append style={rotate=90, anchor=west},
scaled ticks=base 10:0, %insane
]
\addplot+[fill, text=black, error bars/.cd, y dir=both, y explicit]
coordinates {
(1,1450)% +- (121,230)
(2,1478)% +- (4,7)
(3,1494)% +- (18,27)
(4,1476)% +- (18,27)
(5,1494)% +- (18,27)
};
\addplot+[fill, text=black, error bars/.cd, y dir=both, y explicit]
coordinates {
(1,446)% +- (20,32)
(2,1747)% +- (4,7)
(3,2327)% +- (2,4)
(4,2497)% +- (18,27)
(5,2988)% +- (18,27)
};
\addplot+[fill, text=black, error bars/.cd, y dir=both, y explicit]
coordinates {
(1,1293)% +- (14,16)
(2,4740)% +- (4,7)
(3,12252)% +- (4,7)
(4,16091)% +- (18,27)
(5,20115)% +- (18,27)
};
\legend{Robert, Gertrude, Roger}
\end{axis}
\end{tikzpicture}

/pgfplots/x coord trafo/.code={...}I have weird results and the display is empty. Based on your advice and with some further research I found/pgfplots/x filter/.code={...}which appeared to work well. Any idea why? – denaitre Jun 15 '15 at 12:38y filter/.code={\pgfmathparse{(1.8 / #1) * 4096}\pgfmathresult}%– denaitre Jun 15 '15 at 13:55