4
$\begingroup$

I have seen this question before, but with no real solution. The problem is, I have a plot that uses greek characters (sigma to mark first and second standard deviations) and other symbols (e.g. Angstroms), but this information does not translate into the graphs.

This is a MWE, obviously messy since I just want to show that I'm not getting the characters and a lot of the options are remnants from the original plot.

Show[{Plot[Sin[x], {x, 0, 5}], 
  Graphics[Text[Style["+1σ", FontSize -> 14], {4, 0.4}]]}, 
  Frame -> True, FrameLabel -> {{"Å", None}, {"x", None}}, 
  FrameTicks -> Automatic,
  BaseStyle -> {FontSize -> 14, FontFamily -> "Helvetica"}]

(In the last line, I use "BaseStyle" because I saw on here as a potential solution, but it does nothing.)

Here is what the above code outputs in PNG:

enter image description here

As you can see, I need the sigma and the Angstrom symbols to appear. However, when exported to EPS, I get (converted)

enter image description here

The sigmas turn into "s," and the Angstrom symbol disappears.

What is the work-around for this? For reference, I am using Mathematica 9 on Mac OS X (10.6).

$\endgroup$
5
  • 2
    $\begingroup$ I am displaying the exported eps without problems on two systems, one win8 pc on which Mathematica (10) is installed, and another (win7) where it isn't. Update: With V9 I do see problems. $\endgroup$ – Sjoerd C. de Vries Dec 4 '14 at 21:38
  • $\begingroup$ @SjoerdC.deVries, I am using Mathematica 9 on Mac OS X (10.6). $\endgroup$ – Erika H Dec 4 '14 at 21:44
  • $\begingroup$ I know, you said so above. It is sometimes useful to see whether a problem persists over system and version boundaries. This might provide an indication as to the source of the problem. In this case, indications are that (at least on windows) V10 solves a problem that exists on V9. $\endgroup$ – Sjoerd C. de Vries Dec 4 '14 at 21:47
  • $\begingroup$ I see no problem with both v.8.0.4 and 10.0.1 installed on Windows 7 x64. $\endgroup$ – Alexey Popkov Dec 5 '14 at 7:20
  • $\begingroup$ the problem is the fonts are not embedded and the result depends on whether whatever software you use for display has access to the mathematica fonts. For portability you should specify a universally available font such as Symbol. $\endgroup$ – george2079 Dec 5 '14 at 13:35
2
$\begingroup$

following my comment try this:

 fig = Show[{Plot[Sin[x], {x, 0, 5}], Graphics[
        Text[Style["+1 s", FontSize -> 14, FontFamily -> "Symbol"], {4, 0.4}]]},
 Frame -> True, 
    FrameLabel -> {{Style[ FromCharacterCode[197] , FontSize -> 14, 
            FontFamily -> "Helvetica"] , None}, {"x", None}}, 
            FrameTicks -> Automatic, 
            BaseStyle -> {FontSize -> 14, FontFamily -> "Helvetica"}]
 Export["fig.eps", fig]

Notice I use a plain "s" which is the greek "sigma" character in the symbol font. The angstrom symbol isn't in the standard symbol font, so I used the one from the "Helvetica" font ( which in turn gets subbed for ArialMT if you are on one of Mr Gates evil systems. )

I notice by the way inspecting the file the eps still calls for the special mathematica fonts for the math operators ( the "+" and "-" in the labels ) even though we have explicitly specified the font using Style. (It ends up ok since those symbols are pretty much the same in whatever font that gets substituted)

I must say , when I need high quality / portability I punt and use 'tiff'

$\endgroup$
2
  • $\begingroup$ This seems to work so far, but I have one more question, which might be a dumb one: how can I mix text and symbol, so it reads "Line Width ([Angstrom])?" Thanks! $\endgroup$ – Erika H Dec 6 '14 at 20:10
  • $\begingroup$ I solved the above problem using StringJoin. Style[StringJoin["Wavelength (", FromCharacterCode[197], ")"],FontSize -> 14, FontFamily -> "Times"] $\endgroup$ – Erika H Dec 8 '14 at 21:26

Your Answer

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

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