How does pgfplots determine the default size (width and height) of a plot particularly the box defined by axes?

I have checked one of the plots that I generated with default values of pgfplots using trial-and-error and draw the line:

\draw (0,0) -- (6.86,5.69);

It seems like, the inner box is approximately 6.86cm by 5.69cm. Or 194.457pt by 161.291pt.

enter image description here

  • 1
    You can specify the width and height of the box using scale only axis key, and you can get the default width and height using \axisdefaultwidth and \axisdefaultheight. – John Kormylo Jul 13 '17 at 15:31

As you can read in the PGFPlots Manual, Section 4.10.1, page 292 (v1.15)

  • the default width is set by \axisdefaultwidth macro, and it is preset to 240pt
  • the default height is set by \axisdefaultheight macro, and it is preset to 207pt

Also, tick labels, axis labels and the title has a fixed dimension of 45pt. See PGFPlots Manual, Section 4.10.1, page 291 (v1.15).

This means that the box itself would have dimensions of 195pt and 162pt, which is very near the values that you measured yourself.

| improve this answer | |
  • Stefan I proposed some additions from the comment of @JohnKormylo. I will accept your answer after it is reviewed. – berkus Jul 13 '17 at 17:35

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.