3
$\begingroup$

I want to export graphics which has a text object, but it will lose the text when given a special rotate angle.

I have an angle list to show different text on the graphics, here only give a simple codes example (only show one text label).

angles2 = {{0., 0.05922829252191935`}};
labels = {"AAAAAA"};
names = Rotate[
   Text[Style[labels[[1]], Red, 20], 
    1.1*{1.0995176865382061`, 0.032570799647401755`}, {0, 0}], 
   Mean[angles2[[1]]] - \[Pi]/2];
gg = Graphics[{names, Opacity[0.5], Red, Circle[], Rectangle[]}, 
  ImageSize -> 200]
Export["xxx.pdf", gg]

enter image description here

I guess it has something to do with the rotation angle parameter given in the Rotate function, but I don't know how to fix it.

$\endgroup$
2
  • 1
    $\begingroup$ As far as I know, this phenomenon also appears in exported .eps files $\endgroup$
    – yode
    Commented Jan 19, 2022 at 5:58
  • $\begingroup$ right-click and save as pdf or export as png...MMA has a lot of problems when exporting graphics as vectors (pdf or eps) $\endgroup$
    – MMA13
    Commented Jan 19, 2022 at 7:12

1 Answer 1

1
$\begingroup$

use Rotate on the text directly

angles2 = {{0., 0.05922829252191935`}};
labels = {"AAAAAA"};
names = Text[
   Style[Rotate[labels[[1]], Mean[angles2[[1]]] - \[Pi]/2], Red, 20], 
   1.1*{1.0995176865382061`, 0.032570799647401755`}, {0, 0}];
gg = Graphics[{names, Opacity[0.5], Red, Circle[], Rectangle[]}, 
  ImageSize -> 200]
Export["xxx.pdf", gg]
$\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.