3

I am using pgfplots to visualize my experimental results, but some of the experimental results have very large numbers ($10^18-10^19$ for example). The way pgfplots deals with them is that, it puts a large factor (say $10^18$) on top of the figure and chooses the labels as small numbers.

So far, I received some negative feedback about that kind of labeling in my charts; I need to know:

  1. Is there a better way to do this?

  2. Is it standard? can somebody refers to me some good publications that have used the same approach to represent the axis tick labels?

Here is a sample document:

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\begin{document}
            \begin{tikzpicture}
                \begin{axis}
                    \addplot coordinates {
                        (5,-4864175164880)
                        (10,-9728350329760)
                        (15,-14592525494640)
                        (20,-19456700659520)
                        (25,-24320875824400)
                        (30,-29185050989280)
                        (35,-34049226154160)
                        (40,-38913401319040)
                        (45,-43777576483920)
                        (50,-48641751648800)
                    };
                    \addplot coordinates {
                        (5,292862229381084)
                        (10,434852463631792)
                        (15,570475846800798)
                        (20,737825490819198)
                        (25,860718238823815)
                        (30,940754521446225)
                        (35,1062038363787050)
                        (40,1127781160335236)
                        (45,1185587487293437)
                        (50,1237044668474952)
                    };
                    \addplot coordinates {
                        (5,302387809568514)
                        (10,433265146600492)
                        (15,568888291277459)
                        (20,745760136185414)
                        (25,863891556048562)
                        (30,1018505467376564)
                        (35,1114397529527600)
                        (40,1243595912571978)
                        (45,1356917686795978)
                        (50,1438505671531397)
                    };
                    \addplot coordinates {
                        (5,292862229381084)
                        (10,439615017666611)
                        (15,579999984864317)
                        (20,680689964623044)
                        (25,830567187638336)
                        (30,989945779779292)
                        (35,1089013026329017)
                        (40,1192831304307391)
                        (45,1218906437648680)
                        (50,1308435574928259)
                    };
                    \addplot coordinates {
                        (5,302387809568514)
                        (10,447552145712824)
                        (15,632378624837750)
                        (20,758456796364679)
                        (25,905150488169182)
                        (30,1039132937342017)
                        (35,1177859366612789)
                        (40,1267392254011344)
                        (45,1393401240771311)
                        (50,1495605989719142)
                    };
                    \addplot coordinates {
                        (5,292862229381084)
                        (10,434852463631792)
                        (15,570475846800798)
                        (20,737825490819198)
                        (25,860718238823815)
                        (30,940754521446225)
                        (35,1062038363787050)
                        (40,1142060277409340)
                        (45,1187173821398126)
                        (50,1260840969614604)
                    };
                    \addplot coordinates {
                        (5,312696217497890)
                        (10,565002605927478)
                        (15,857723287379634)
                        (20,1129748942677279)
                        (25,1334295395262765)
                        (30,1579251153778012)
                        (35,1767865804266326)
                        (40,1996881068279606)
                        (45,2225851981990703)
                        (50,2401688802214620)
                    };
                \end{axis}
            \end{tikzpicture}           
\end{document}
  • No, I'm afraid there really isn't. The behavior you describe is exactly what I would want to see done in charts. It should be pretty simple for those in affected fields to draw up counterexamples for you to use. A solid reference you can use is Trees, Maps, and Theorems; it's all about this kind of stuff. – Sean Allred Oct 23 '14 at 1:50
  • @emab What field are you working in? – Jake Oct 23 '14 at 5:29
  • 2
    What I usually do if I need to plot your diagram, I would divide the y-value by 1e15 and then add a corresponding y-label with the unit in peta-whatsoever (or milli/micro/nano/pico...). However, this is only useful, if you have to plot something with units. – bene Oct 23 '14 at 6:36
  • @Jake I'm working on large networks but I haven't seen such large numbers in other papers (they certainly haven't dealt with such metrics) – orezvani Oct 23 '14 at 7:10
  • 1
    What kind of negative feedback did you receive (which is strange anyway)? And what do they do instead then print out the whole number? – percusse Oct 23 '14 at 7:26
2

This is your original plot:

enter image description here

I think you want to edit the scale factor which is mentioned automatically by the pgfplots on your plots. I found a sample code on this answer on this site, which may help you. This is possible by using two codes bellow which are added to the

\begin{axis}[]

If you want to write your own preferred scale factor on the axis, you can use this:

ytick scale label code/.code={}

enter image description here

you may have a scale factor like $10^15$ or what ever you want in the .code={$10^15$}. You may also use some metric prefixes instead of the power number, for instance P for peta and 10^15 or E for exa and 10^18.

If you don't want to have any scaling factor added to your plot, leave the space inside .code={} empty, so nothing will be printed.

Also, you can use

scaled y ticks={real:1000000000000000}

enter image description here

to scale the y axis values as much as you prefer, but the format of the scaled numbers will be somehow the same as the default scaling format you have in your original plotting code.

As a matter of fact, the other option you have is to refine the data before you put them in your latex code. If you want them to have values smaller than what they appear in your plot, a rough solution may be editing your data before, in a spreadsheet or your programming compiler and then copy them in your plotting data.

Questions bellow may also help you with your problem:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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