3
$\begingroup$

I was playing with the Arrow primitive and needed to draw a dashed arrow, as in

Graphics[{Dashed, Arrow[{{0, 0}, {1, 1}}]}]

However, when exporting the figure to a pdf file with Export or even with the "Save Graphic As..." menu produces an image in which the arrow's head has a dashed border, which is (correctly, I think) not visible in Mathematica.

To better check the effect, just increase the arrow's head

Graphics[{Dashed, Arrowheads[1], Arrow[{{0, 0}, {1, 1}}]}]

and enlarge the graphics.

I'm using Mathematica 12.3 on a Mac.

Is this a bug or something that can be fixed?

--- EDIT

It appears that the problem only occurs with vector formats (pdf, svg, ...), but not with raster formats (GIF, JPEG, ...).

The first image is what you correctly obtain with a raster format (GIF), while the second one shows a dashed border around the arrow's head after exporting to PDF.

Correct image in GIF format

Incorrect image with dashed border in PDF format

$\endgroup$
3
  • $\begingroup$ it would be nice if you can attache an image. $\endgroup$
    – MMA13
    Commented Nov 1, 2021 at 18:09
  • $\begingroup$ I believe this is a known (& older) issue, but I cannot recall the precise wording of the QA that this potentially duplicates. $\endgroup$ Commented Nov 1, 2021 at 22:27
  • $\begingroup$ @valarmorghulis Added two images illustrating the problem. $\endgroup$
    – Maiaux
    Commented Nov 1, 2021 at 22:43

1 Answer 1

1
$\begingroup$

That behavior comes from the assigned style Dashed where it makes the edge of the head of the arrow dashed too. I tried EdgeForm[None] but still there, so as a workaround you can add a dashed line while keeping the arrow out like this

Graphics[{{Arrowheads[1], Arrow[{{0.99, 0.99}, {1, 1}}], Dashed, 
   Line[{{0, 0}, {1, 1}}]}}]    

and this is how the picture in the pdf looks like

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks for the workaround. It is, however, a bit unfortunate to have to compute the coordinates of the {0.99,0.99} point, which is easy to do here, but less comfortable in more complex scenarios. So I'll wait for more solutions some more time before accepting this one. BTW, is this a confirmed Mathematica but, then? $\endgroup$
    – Maiaux
    Commented Nov 2, 2021 at 9:17
  • $\begingroup$ I meant Mathematica bug, of course $\endgroup$
    – Maiaux
    Commented Nov 2, 2021 at 12:05

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.