[Tex/LaTex] axis lable in millions/thousands

bar charttikz-pgf

I have a simple barchart, on the y axis i have values which are displayed full written (e.g. 5'000'000). I dont want to change the orginal data but change the y-axis lable into a fullwritten value e.g. "5 Mio."

Any Idea how to approach this target, I tried but couldn't find anything useful.The only thing I found is something for tables, and I think it should be possible whith barcharts as well, any hint ? I guess I need to have a temporary value which devides just the lable on the y-axis

cheers endo

Best Answer

You can scale all the tick labels by a common factor using scaled y ticks=base 10:-6 (dividing by 10^6). To switch off the scaling label, set ytick scale label code/.code={}. To add the word million after each label, set yticklabel={\pgfmathprintnumber{\tick} million}:


    scaled y ticks=base 10:-6,
    ytick scale label code/.code={},
    yticklabel={\pgfmathprintnumber{\tick} million}
\addplot {rand*1e7};

Related Question