1
$\begingroup$

I use the following code to generate and export a simple combined figure with an epilog of the long horizontal arrow.

inten = (x y (z^3 + 0.2))/(x^2 + y^2 + z^2 + 0.01);
max = 1; zlst = Range[2, -2, -4/(5 - 1)];
frameticks = {-0.5, 0.5};

plot0 = Table[
   ContourPlot[
    inten /. z -> zlst[[-i]], {x, -max, max}, {y, -max, max}, 
    FrameTicks -> {{frameticks, None}, {frameticks, None}}, 
    ImagePadding -> {{Automatic, Automatic}, {23, 36}}, 
    ImageSize -> 160], {i, Length@zlst}];
plot = GraphicsRow[plot0, 
  Epilog -> {Gray, Thickness[0.01/3], Arrowheads[0.015], 
    Arrow[{Scaled[{0, 0.96}], Scaled[{0.94, 0.96}]}]}, 
  ImageSize -> 1000]

Export["Fig_try.pdf", plot]

It looks good in the front end, but is weirdly damaged in two aspects in the exported pdf.

  1. The arrowhead at the top right corner is cut out;
  2. There appear many glitches around the boundary of each plot.

From the comments received, it seems not limited to my machine or to PDF format. Any remedy or workaround?

enter image description here

$\endgroup$
12
  • $\begingroup$ Please include your data (or fake sample data) so that we can run your code, otherwise it may be difficult to troubleshoot. A shot in the dark: Does using Row instead of GraphicsRow improve the situation at all? $\endgroup$
    – MarcoB
    Jun 18 at 13:29
  • $\begingroup$ @MarcoB The code is self-contained. And I need GraphicsRow instead of Row to add various epilogs. $\endgroup$
    – xiaohuamao
    Jun 18 at 13:35
  • $\begingroup$ This seems like a bug—it happens with other vector graphics formats like .svg and .eps, and isn't specific to the .pdf export. I'm guessing you want vector graphics—but if not, then exporting to .png (with e.g. Export["Fig_try.png", plot, ImageResolution -> 600]) seems to work. (There are still some misalignments with the contour lines starting too early and ending too late, but if you look closely, you'll notice these are already present in the notebook itself!) $\endgroup$
    – thorimur
    Jun 18 at 23:39
  • $\begingroup$ @thorimur Thanks for the info on other formats. Yes, I want vector graphics basically. BTW, I don't see any contour lines overplotted in my front end as far as I've zoomed in. $\endgroup$
    – xiaohuamao
    Jun 19 at 0:18
  • $\begingroup$ Oh, that's good! maybe it's a version difference or an OS difference. As for getting vector graphics...hmm. might be worth it to contact wolfram support about it. There also might be ways to refine the shapes or translate them to a format that's more amenable to svg export. By examining FullForm, we see that the regions of the plots are currently GraphicsComplexes of GraphicsGroups of Polygons. I wonder if converting them to some other form, like meshes(?), or messing with their vertex-related options would have any effect on the export. $\endgroup$
    – thorimur
    Jun 19 at 0:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.