11

Bug introduced in 10.0.1 or 10.0.2 and fixed in 10.1.0


In version 10, if we plot with Sqrt in y-axis, and export to PDF, the square root disappears in the PDF file.

p = Plot[x, {x, 0, 1}, Frame -> True, 
  FrameLabel -> {"x", "\!\(\*SqrtBox[\(y\)]\)"}]

enter image description here

Export["test.pdf", p];

enter image description here

This does not happen in version 9.

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
Yi Wang
  • 7,347
  • 4
  • 28
  • 38

2 Answers2

8

Looks like a bug. Stupid workaround:

Export["t:\\test.pdf", ImportString@ExportString[p, "EPS"]]

At the very least, there's a good chance that this would output reasonable vector graphics.

Or,

p = Plot[x, {x, 0, 1}, Frame -> True, FrameLabel -> {x, Sqrt[y]}]

The latter is what I usually do, anyway.

Gleno
  • 1,501
  • 11
  • 16
  • Thanks a lot! Very clever workaround :) I actually also tried the second method. However, my actual y-axis is quite complicated and I don't want Mathematica to automatically format the equation for me. So a string is preferred. – Yi Wang Jul 25 '14 at 21:58
4

The problem seems to be when the label is rotated. Check this:

Export["test.pdf", 
 ListPlot[{1, 2, 3}, Joined -> False, Frame -> True, 
  FrameLabel -> {Rotate["\!\(\*SqrtBox[\(x\)]\)", \[Pi]/2], 
    "\!\(\*SqrtBox[\(y\)]\)"}]]

however if you accept unrotated label, you can use:

Export["test.pdf", 
 ListPlot[{1, 2, 3}, Joined -> False, Frame -> True, 
  FrameLabel -> {"\!\(\*SqrtBox[\(x\)]\)", "\!\(\*SqrtBox[\(y\)]\)"}, 
  RotateLabel -> False]]

enter image description here

Basheer Algohi
  • 19,917
  • 1
  • 31
  • 78