[Tex/LaTex] pgfplots and mathematical expression with coordinates list

pgfplots

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}

Best Answer

From the manual about coordinate lists

You should only use this input format if you have short diagrams and you want to provide mathematical expressions for each of the involved coordinates. Any data plots are typically easier to handle using a table format and \addplot table.

But if you really have to, you have to provide the coordinate transformations manually for all plots in the axis environment hence it wouldn't be ideal because the axes needs to be setup: Here I fake a linear plot with a squared input

\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
  \begin{tikzpicture}
    \begin{axis}[ 
      axis x line=bottom,
      axis y line=left,
      ultra thick,
      y coord trafo/.code={\pgfmathparse{sqrt(#1)}},
      y coord inv trafo/.code={\pgfmathparse{pow(#1,2)}}
    ] 
    \addplot coordinates {(0,0)(1,1)(2,4)(3,9)(4,16)(5,25)};
  \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

See section 4.22 for more information about these transformations