2
$\begingroup$

I noticed that when I run my code to draw a plot:

ListPlot[{valAlpha, tk100},
 PlotStyle -> Directive[AbsolutePointSize[85]],
 GridLines -> Automatic, 
 GridLinesStyle -> Directive[Gray, Dashed],
 Frame -> {True, True, False, False},
 FrameLabel -> {"Number of non-zero bits", "alpha"},
 Axes -> False,
 FrameTicksStyle -> Thick,
 LegendShadow -> None,
 PlotLegend -> {Style["exact value", FontFamily -> "Helvetica", 180], 
   Style["estimated value", FontFamily -> "Helvetica", 180]},
 LegendSpacing -> 2.0,
 LegendOrientation -> Horizontal,
 LegendSize -> {1.3, 0.15}, LegendPosition -> {-0.83, 0.55},
 LegendBorder -> White,
 LegendTextOffset -> {-0.8, 2.0},
 PlotRange -> {0, 10},
 ImageSize -> 7500,
 PlotRangeClipping -> False]

I have different distance between labels in legend. First picture show plot saved as .jpg, and the second as .eps

enter image description here

enter image description here

How can I set the distance between label 'exact' and 'estimated' to be as close as in the first pic, but using format .eps to save the plot?

$\endgroup$
  • 2
    $\begingroup$ Since V9 PlotLegend has been superseded by the much better built-in option PlotLegends (note the 's' at the end). Have you tried that? $\endgroup$ – Sjoerd C. de Vries Nov 11 '14 at 23:46
2
$\begingroup$

Mathematica uses the style environment specified by the ScreenStyleEnvironment FrontEnd option for on-screen rendering and Exporting into raster formats but for printing and Exporting into PostScript formats it uses the style environment specified by the PrintingStyleEnvironment option. They have different values by default:

Options[$FrontEnd, {PrintingStyleEnvironment, ScreenStyleEnvironment}]
{PrintingStyleEnvironment -> "Printout", 
 ScreenStyleEnvironment -> "Working"}

If you set PrintingStyleEnvironment identical to ScreenStyleEnvironment then EPS and PDF figures will look exactly as on the screen:

SetOptions[$FrontEndSession, PrintingStyleEnvironment -> "Working"]

See this Toolbag answer for more information: "General PDF/EMF export problems and solutions."

P.S. I recommend to use lossless PNG format for Exporting if you need your plot as a raster image: JPG format is lossy and designed for storing photos, it introduces artifacts into scientific drawings.

$\endgroup$

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.