4
$\begingroup$

I have the following code to generate a 2D plot:

fig1 = Framed[
  Show[Graphics[{Orange, Opacity[1], 
     ConicHullRegion[{{0,0}}, {{-1,0},{1,1}}]}, 
    PlotRange -> {{-1.6, 1.6}, {-1.6, 1.6}}, Axes -> True, 
    LabelStyle -> {14, Bold, Black}, ImageSize -> Medium], 
   Graphics[{Black, Arrowheads[0.04], Thickness[0.01], 
       Arrow[{{0, 0},  {-1, 0}}] , 
     Text[Style[OverVector[Subscript[e, 1]], Medium, Bold, 
       Black], {-0.5, 0.15}]}], 
   Graphics[{Black, Arrowheads[0.04], Thickness[0.008], 
       Arrow[{{0, 0},  {1, 1}}] , 
     Text[Style[OverVector[Subscript[e, 3]], Medium, Bold, 
       Black], {0.32, 0.5}]}]]]

Mathematica generates the plot correctly but when I try to Export[] this plot as .pdf or using "Save Selection As..." then the image in the pdf has blunt arrow heads, which looks weird and different from the plot shown in Mathematica. I think this is a bug. I also tried to CloudExport[] on Mathematica online but the same problem persists.

Can someone help me to fix this problem?

$\endgroup$
5
  • $\begingroup$ This is what I get in the pdf: image. I don't see blunt arrowheads, so it may be system-dependent. You should show what you see by posting a picture of your output. $\endgroup$
    – MarcoB
    Commented Dec 11, 2020 at 16:42
  • $\begingroup$ Thank you for your comment. This is what I get in the pdf: imgur.com/a/Gxar25F $\endgroup$
    – Epsilon
    Commented Dec 11, 2020 at 17:48
  • $\begingroup$ I've had similar issues with arrows. I believe it's caused by Mathematica trying to draw a border around things whenever it exports to PDF (or SVG). I assume it's a bug since EdgeForm[] still results in a border, but only when exporting to PDF/SVG. A high resolution PNG has no issues. If I open the PDF in Affinity, I can select the arrows, remove the border, and they look great. If I use a polygon as the arrowhead, it ends up drawing different border thicknesses for your code and makes the arrows appear to be different sizes. I'm on macOS 11.0.1 with MMA 12.1.1 June 9, 2020. $\endgroup$
    – MassDefect
    Commented Dec 11, 2020 at 20:03
  • $\begingroup$ 12.1.1, Linux, work well,the arrow head is sharp. $\endgroup$
    – cvgmt
    Commented Dec 12, 2020 at 0:43
  • $\begingroup$ I can confirm I have the same issues now, and unfortunately this means new exports of the same Mathematica code no longer produce the same figures I made in the past. MMA 12.1.1 on Windows. If someone has found a less hacky solution by now I'd still be interested. $\endgroup$
    – TMM
    Commented Apr 8, 2021 at 1:44

1 Answer 1

5
$\begingroup$

More of a workaround than a fix, but you can use Graphics to specify the arrowheads:

ah = Graphics[Triangle[{{-1, .4}, {0, 0}, {-1, -.4}}]];

fig2 = Framed[
  Show[Graphics[{Orange, Opacity[1], 
     ConicHullRegion[{{0, 0}}, {{-1, 0}, {1, 1}}]}, 
    PlotRange -> {{-1.6, 1.6}, {-1.6, 1.6}}, Axes -> True, 
    LabelStyle -> {14, Bold, Black}, ImageSize -> Medium], 
   Graphics[{Black, Arrowheads[{{.03, 1, {ah, 1}}}], Thickness[0.01], 
     Arrow[{{0, 0}, {-1, 0}}], 
     Text[Style[OverVector[Subscript[e, 1]], Medium, Bold, 
       Black], {-0.5, 0.15}]}], 
   Graphics[{Black, Arrowheads[{{.03, 1, {ah, 1}}}], Thickness[0.008],
      Arrow[{{0, 0}, {1, 1}}], 
     Text[Style[OverVector[Subscript[e, 3]], Medium, Bold, 
       Black], {0.32, 0.5}]}]]]

Export["test.pdf", fig2]

enter image description here

This exports with normal pointy arrows.

$\endgroup$

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.