Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
1  
It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. –  Peter Grill Feb 17 at 21:51
    
you're right, sry –  endo.anaconda Feb 17 at 23:12

1 Answer 1

up vote 7 down vote accepted

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}:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}


\pgfplotsset{compat=1.9}
\begin{tikzpicture}
\begin{axis}[
    scaled y ticks=base 10:-6,
    ytick scale label code/.code={},
    yticklabel={\pgfmathprintnumber{\tick} million}
]
\addplot {rand*1e7};
\end{axis}
\end{tikzpicture}

\end{document}
share|improve this answer
1  
bah, don't you have a phd or something? I'm typing very nicely and peacefully here :P –  percusse Feb 17 at 22:40
1  
@percusse: Hehe! Actually, starting a "real" job in two weeks. PhD'ing isn't for me, it turns out. I see Word and Excel looming ahead... –  Jake Feb 17 at 22:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.