Message Boards Message Boards


Avoid bold font Exported graphics? (MMA 11.3 on macOS)

Posted 8 months ago
8 Replies
3 Total Likes

I've been trying to make publication quality graphics and ran into this problem.

Here's some test code I ran in Mathematica, on macOS 10.14.1 (18B75).

fig = Plot[Sin[x*(Pi)], {x, 0, 2}, Frame -> True, Axes -> False, 
  FrameLabel -> {"\!\(\*
StyleBox[\"x\",\nFontSlant->\"Italic\"]\)/\[Pi]", "sin(\!\(\*
  LabelStyle -> {Black, Thin}, ImageSize -> 200] 

Export[NotebookDirectory[] <> "testFig.pdf", fig];

The output file looks like this (screenshot of the pdf). enter image description here

whilst in the notebook it looks like this (screenshot) enter image description here

I run the same code in my Windows 8.1 partition, running Mathematica 11.3 and the exported graphic looks like I expect it to. Any ideas why this happens/ if there's a solution?

P.S. I've checked that png outputs give the same result - they do. I've also played around with the LabelStyle options and had no luck.

8 Replies


This is a bug -- for what its worth, it is fixed in V12.

As for workarounds, these all seem to work:

Export["testFig.png", fig, ImageResolution -> 600]
Export["testFig.tiff", fig, ImageResolution -> 600];
Export["testFig.jpg", fig, ImageResolution -> 600];



Thanks Neil.

Do you know of any workaround that works for a pdf output? Ideally I'd like to export vector graphics.


We can print to pdf with File > Print selection as, which is not affected by the bug. On the other hand, we get the picture inside a whole pdf page, and we will probaby have to crop it.

That sort of works but in ListPlot I end up with some of the points coming out of the frame. I'm happy enough to just switch OS to get these graphics...

Posted 8 months ago


One suggestion would be to use a PDF Editor to change the fonts after the file is generated.

However, I have found that PDF output is not always the best option for publication quality. If you have many points in your plot and multiple plots, the PDF becomes problematic and causes other programs (i.e. Word, Powerpoint) to crawl to a stop. I had my best results using png files at high resolution (usually 300 but 600 or more if you really want super high res). The programs that use the graphics are much happier with rasterized files. I do all my reports this way because PDF files in the past caused me many problems.



As an example do this:

Export["testFig2.pdf", ListLinePlot[ RandomReal[1, 10000]]]

Insert several of these into word -- each one takes over 10 seconds to import. Now scroll the page and try to move around -- the response is terrible.

Now do this:

Export["testFigRas.png", ListLinePlot[ RandomReal[1, 10000]], 
 ImageResolution -> 600]

Insert this file multiple times into Word and the insert is instantaneous and the responsiveness of Word is unaffected.



Vector pdf is way better at small file sizes. Above a certain size we are forced to resort to bitmap.

Thanks for your replies everyone.

I have come across this problem with pdfs/vector graphics, and came across the solutions described here which allow you to rasterise the content of the graph while having the frame, ticks, labels etc. in vector form.

I'm putting the graphics into a LaTeX document which seems to manage fine (compiles quickly, output loads quickly in Adobe Reader). This is the case for ListPlots and Plots, but not for ListDensityPlots (which is where I used the workaround I described above).

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract