3
$\begingroup$

Bug introduced in 10.4.1 or earlier and persisting through 12.0
Bug isn't present in version 8.0.4


I am trying to export a graphic generated by the following code to a .pdf file.

c := 1;
ctoP = 0.80;
P := c/ctoP;
s0 := 0.0;
sf := 1.5;
\[Theta]0 := Pi/180*45;
theta = 
 DSolve[{\[Theta]'[s] == Sqrt[
 2.0 (c + P Cos[\[Theta][s]])], \[Theta][
 0] == \[Theta]0}, \[Theta], s];

elastica = 
  NDSolve[{x'[s] == Cos[\[Theta][s]], y'[s] == Sin[\[Theta][s]], 
  x[0] == 0, y[0] == 0} /. theta, {x, y}, {s, s0, sf}];

deformed = 
 ParametricPlot[{x[s], y[s]} /. elastica, {s, s0, sf}, 
  PlotPoints -> 500, Frame -> False, Axes -> False,

  FrameStyle -> Black,

  PlotPoints -> 200,

  PlotStyle -> {Black, 
    Thickness[0.003]},

  PlotRange -> {{-8, +8}, {-2, 4}},

  ImageSize -> Large
  ]


Export["figure.pdf", deformed, ImageResolution -> 1500]

The file "figure.pdf" obtained has the following unwanted features (highlighted using red ovals) on it:

enter image description here

Interestingly enough, these features do not appear if the file is exported as a .png or .jpeg.

I've also tried exporting the graphic as an .eps file, but the problem still remains.

I need the file in .pdf format because I don't want my figures to be rasterized.

How can I get rid of these artifacts on the pdf and obtain a nice smooth curve?

$\endgroup$
3
  • $\begingroup$ Which Mathematica version and PDF viewer do you use? With Mathematica 8.0.4 on Windows 7 x64 I do not see the artifacts when open the PDF by Adobe Acrobat 11: screensnhot. $\endgroup$ Jun 10, 2017 at 6:14
  • $\begingroup$ I am using Mathematica version 11.0.0.0 on macOS Sierra (version 10.12.5). To open the PDFs, I use Preview. $\endgroup$
    – Neo
    Jun 10, 2017 at 12:33
  • $\begingroup$ Please report this to the official tech support. $\endgroup$ Jun 19, 2017 at 18:09

1 Answer 1

1
$\begingroup$

This looks like a bug in PDF export. I do reproduce it with version 10.4.1 and 11.1.1 but not with version 8.0.4 on Windows 7 x64.

In order to ensure that it is not due to the other functions used I saved the deformed plot generated by Mathematica 8.0.4 and then imported it into more recent versions for further exporting as PDF:

(* in Mathematica 8.0.4 *)

deformed >> deformed.m

(* in more recent versions *)

Export["figure.pdf", << deformed.m] // SystemOpen

Here is how the files exported from versions 10.4.1 and 11.1.1 are rendered by Adobe Acrobat 11:

screenshot

And here is how the file exported from Mathematica 8.0.4 is rendered:

screenshot

$\endgroup$
1
  • $\begingroup$ I think I have found a work around to this problem. If you reduce the number of PlotPoints to about 100, this issue goes away. $\endgroup$
    – Neo
    Jun 29, 2017 at 13:05

Your Answer

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

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