For some reason, the parameter fixed in my style textnumber is ignored when used as a parameter to \addplot.


Note how the x labels are written in scientific notation despite the parameter definition containing fixed. enter image description here



% For the sake of aesthetics, define some colors that are not ugly
\definecolor{amber}{rgb}{1.0, 0.49, 0.0}
\definecolor{bleudefrance}{rgb}{0.19, 0.55, 0.91}
}% \addplot style, bar format

% Define a bar chart
 % symbolic y coords=,% set dict of expected textual y coordinates, we avoid this dup of data by using "yticklabels from table" and "ytick=data"
  axis lines*=left,
  y=12mm,% vertical spacing (define the length of a unit in the y direction )
  bar width=4mm,% bar thickness
  y axis line style = { opacity = 0 },
  x axis line style = { black!35 },
  width=.6\textwidth,% width of chart itself, does not include tick labels
  xlabel={}, % optional label below x axis but useless in global style
  minor xtick={25,50,...,75},
  point meta={x},
  every node near coord/.append style={font=\bfseries},
  nodes near coords align={horizontal},% alignment of "nodes near coords"
  enlarge y limits={abs=10mm},% add space above and below bars
  yticklabels from table={\datatable}{0}, % necessary for pgfplotstableread data
  xticklabel={\pgfmathprintnumber[textnumber]{\tick}}, % disable math mode
  x tick label style={font=\footnotesize,black!35},
  y tick style={opacity=0},
  y tick label style={font=\raggedright\small,color=black!65,align=right,text width=.4\textwidth},
  legend style={font=\footnotesize},
  label style={font=\footnotesize},
  minor grid style={dotted,black!65},

% Define text used in bar chart
  /pgf/number format/textnumber/.style={
    fixed,% no scientific notation
    assume math mode=true,
    set thousands separator={},

% Define user level/document level environment
\NewDocumentEnvironment{horizontaldualbarchart}{ m m } % #1: sollmax #2: istmax
  % Inject BODY into pgfplotstableread
  \pgfplotstableread[col sep=comma, 
  % Use \datatable for plot data
   \begin{axis}[horizontalbarchartstyle,xmax=#2,xtick={0,#1,#2},minor xtick={#1}]
     \addplot [style-addplot-color2, nodes near coords={\color{amber}\pgfmathprintnumber[textnumber]{\pgfplotspointmeta}}] table [col sep=comma, y expr=\coordindex, x index=2] {\datatable};
     \addplot [style-addplot-color1, nodes near coords={\color{bleudefrance}\pgfmathprintnumber[textnumber]{\pgfplotspointmeta}}] table [col sep=comma, y expr=\coordindex, x index=1] {\datatable};


{Analysis}, 0, 0
{Creation of Information}, 20004, 415845
{Adaptions of Information}, 14400, 0


1 Answer 1


You need

scaled x ticks=false

I'm guessing the scaling happens before the number is passed to xticklabel, so the values that \tick refers to are actually 3.67 and 5.16, not 3.67e5/5.16e5.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .