When it comes to plotting a data my general attitude is to avoid post processing (say with adobe illustrator) as much as possible. To follow this strategy I would like to prepare publication-ready pdf plots with Mathematica. Here are my requirements

  • Plotted lines should have width of exactly 1pt.
  • The same should be true for the lines forming axes, frames, ticks.
  • The ticks have a commensurate length. I find it is optically pleasing to have major ticks of 4pt lengths.
  • The graph should have a dimension of one column, i.e. ~ 8.5cm or 240pt.
  • All the tick labels, axes labels, etc. should be done with 12pt Helvetica.
  • No white background.

One can argue about the art value of this setup. I, personally, find it is a good compromise between the visibility and simplicity. I remember these numbers and keep them the same across different programs and publications.

I tried to develop very easy solution that can be kept in mind. Since there is a known problem with tick length (it cannon be set explicitly) I decided to adjust the rest of parameters to this dimension. At first step I am just plotting the function

fx[x_] := 1/(Exp[-x - 7] + 1) + 1/(Exp[x - 7] + 1) - 1

with default settings and nice blue-apple color

blue = RGBColor[17.6/100, 41.6/100, 63.1/100];
u = Plot[fx[x], {x, -15, 15}, 
      PlotRange -> All, AxesLabel -> {"x", "fx(x)"}, 
      PlotStyle -> Directive[AbsoluteThickness[0.5], blue]]

The absolute thickness was set to 0.5pt because I am going to enlarge the graph on the second step:

  AxesStyle -> Directive[AbsoluteThickness[0.5], 6, FontFamily -> "Helvetica"], 
  ImageSize -> 120]
Export[FileNameJoin[{$UserDocumentsDirectory, "u1.pdf"}], %]

As you see the graph has now the horizontal dimension of 120pt, i.e. 50% of the desired result. But I tolerate this since it is a vector graphics. All lines have the right thickness of 50%$\times$1pt=0.5pt and major ticks are of 50%$\times$4pt=2pt. The font sizes are also right: 50%$\times$12pt=6pt.

The only problem in present approach is wrong placement of some tick labels. Numbers -10 and 10 are vertically misaligned:

enter image description here

I would appreciate any help on this particular issue, or, on the production of publication ready graphs in general. I explicitly decline possibilities of drawing ticks manually, using additional packages or post processing. Please, feel free to criticise my artistic style.


I would like to make some comments on my approach. The whole idea comes from the fact that it is unacceptable for me to use additional packages for very simple plots. At the same time I have very modest requirements on graphics parameters for visual appeal. Crucial parameters for me are the lines' thickness and the ticks' length. Since there is no simple way to set the ticks' length explicitly I am forced to rescale the image. That is, the image of 240pt is required, however, it is prepared at 120pt. Everything would be perfect provided ticks' labels are properly placed.

  • $\begingroup$ Sidenote: Did you take a look at the LevelScheme package? The included CustomTicks package may come in handy for high-quality plots. $\endgroup$
    – Yves Klett
    May 12, 2014 at 16:08
  • 2
    $\begingroup$ The numbers "-10" and "10" should be vertically aligned with "-15", "-5", etc. $\endgroup$
    – yarchik
    May 12, 2014 at 16:16
  • 1
    $\begingroup$ They are aligned properly on 9.01 on Win 7... what OS/viewer setup do you have? $\endgroup$
    – Yves Klett
    May 12, 2014 at 16:21
  • 1
    $\begingroup$ I don't see how this is related, but just in case I'll link: (2214) $\endgroup$
    – Mr.Wizard
    May 12, 2014 at 16:27
  • 1
    $\begingroup$ @Öskå $UserDocumentsDirectory... any better? $\endgroup$
    – Yves Klett
    May 12, 2014 at 16:30

1 Answer 1


I don't understand why you do things at half-size and say "I am going to enlarge the graph on the second step". When I evaluate your code don't get any enlargement in the PDF file. However, I do see your problem with tick label alignment.

I decided to see what happened if I did the enlargement in Mathematica, before exporting.

u2 = 
        AxesStyle -> Directive[AbsoluteThickness[0.5], 6, FontFamily -> "Helvetica"], 
        ImageSize -> 120], 
Export[FileNameJoin[{HomeDirectory[], "Desktop", "u2.pdf"}], u2]

In OS X Preview, I converted the PDF image to PNG with a resolution of 72-points/inch and got the following;


There is no misalignment in the tick labels. Perhaps this can be work-around for you.


As I said above, I don't understand your approach. On the other hand, when I do it the naive way

u = 
  Plot[fx[x], {x, -15, 15}, PlotRange -> All, 
    AxesLabel -> {"x", "fx(x)"}, 
    PlotStyle -> Directive[AbsoluteThickness[1], blue],
    AxesStyle -> Directive[AbsoluteThickness[1], 12, FontFamily -> "Helvetica"],
    ImageSize -> 240]
Export[FileNameJoin[{HomeDirectory[], "Desktop", "u2.pdf"}], u]

I get a PDF document with the image having the precise dimensions you specify (240 x 164.35 pts). The lines are 1 pt thick and the major ticks are 4 pts. The text is rendered at 12-pt height. I don't understand why you reject doing it this way.

  • $\begingroup$ And that is exactly my problem. It just looks ugly. All sizes are wrong. I repeated your recipe and that is what I got: 1) the width of the graph 172.8 pt instead of 120 or 240pt. 2)The major ticks have length 1.808 pt and width 0.72 pt with the ratio 2.5:1 instead 4:1 . If I scale your pdf output to desired 240pt width I get the ticks and line width of correct 1pt. However, as I said, the ticks are too short and I find it strange to deal with 8.64pt fonts! $\endgroup$
    – yarchik
    May 13, 2014 at 8:17
  • $\begingroup$ I repeated again your recipe, now the updated version. Your claim about the tick's length is not right. The major ticks have dimensions 2.59$\times$1pt. The ratio is almost the same as before, i.e. 2.6:1 ! $\endgroup$
    – yarchik
    May 13, 2014 at 10:42
  • $\begingroup$ @yarchik. I believe you should add 1 pt to account for the thickness of the axes. I measured from the center of an axis line to the end to a major tick. My point ruler gave 4 pts. $\endgroup$
    – m_goldberg
    May 13, 2014 at 10:54
  • $\begingroup$ I measure in the same way. I can imagine the measurement process can be software dependant. In order to avoid extended discussions on the measurement rules try to get major ticks 8pt$\times$1pt in your coordinate system. $\endgroup$
    – yarchik
    May 13, 2014 at 10:59
  • $\begingroup$ I can confirm yarchik version, I have mathematica 10.0.1 on windows 7 x64 and I get 2.61 pt from the center of the axis to the very left edge of the long tick and 3.13 pt from the very left edge of the axis to the very right edge of the tick, using @m_goldberg's code. For yarchik original version of the code I am getting 2.03 and 2.29 pt. $\endgroup$
    – atapaka
    Jul 28, 2015 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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