开发者

Exporting graphics for publications: how to achieve consistent line thicknesses in plot elements?

开发者 https://www.devze.com 2023-03-04 00:39 出处:网络
It seems that creating publication-quality graphics with mma is a black art that dates back decades.Although things have much improved in recent years, it is still hard to get consistent results when

It seems that creating publication-quality graphics with mma is a black art that dates back decades. Although things have much improved in recent years, it is still hard to get consistent results when exporting to files. The way the final result looks seems to be somewhat format-dependent (with EPS working best in my experience).

Quite often, the lines in frames and tick marks end up being too faint in the EPS file, and when trying to do something like FrameStyle->AbsoluteThickness[2], it is easy to get lines that are too thick. So, my current approach involves taking five parameters -- three line thicknesses (in FrameStyle, AxesStyle, and PlotStyle), ImageSize, and FontSize in BaseStyle -- and randomly tweaking them until the exported plot looks acceptable. This is somewhat unsatisfactory and time consuming.

Is there a better way and/or a standard prescription to follow in order to achieve balanced, good-looking plots?

Edit: here's one example. Looks good on screen (see screenshot), but export it into EPS and you'll probably see two things: (a) There's a bug with EPS font embedding: for me, the epsilon inside the figure doesn't embed properly unless I remove the FontWeight->Normal directive. (b) The frame/tick lines are light-gray and 1 pixel thick. If I wanted to shrink this figure (e.g. to place it as an inset), it would trash the quality. However, using AbsoluteThickness[2] looks bad -- so I have to increase ImageSize. But then the fonts are too small and/or lines in the plot look too thin, etc, etc.

With[{exSubscript = "\[UpTee]", epsFontSize = 24, 
   xcoords = {0.63, 2.2}}, testInset = Style[Inset[Cell[TextData[Cell[
      BoxData[F开发者_如何学CormBox[SubscriptBox["\[Epsilon]", exSubscript], 
           TraditionalForm]]]]], xcoords, {Left, Baseline}], 
     FontWeight -> Normal, FontSize -> epsFontSize];
  ];
Show[Plot[10 x^2, {x, 0, 1}, PlotStyle -> Thick, Frame -> True, 
  PlotRange -> {-2, 8}, Epilog -> {testInset}], Axes -> {True, True}, 
 AxesOrigin -> {0, 0}, AxesStyle -> Dashed, 
 FrameLabel -> {"\[Lambda] [\[Mu]m]", "Re{\[Epsilon]}"}, 
 BaseStyle -> {FontSize -> 22, FontWeight -> Plain, 
   FontFamily -> Helvetica}, ImageSize -> 500]
Export["test.eps", %]

Exporting graphics for publications: how to achieve consistent line thicknesses in plot elements?

Edit: Accepting Szabolcs' answer, but Mr.Wizard should be given credit for pointing out the FontFamily -> Helvetica vs FontFamily -> "Helvetica" behavior (which seems like a bug). Without the quotes, PDF export is a non-starter due to screwed-up fonts.


Screen vs print viewing

It is difficult to compare line thicknesses on screen, especially when the displayed thickness would get close to 1 pixel. I found it's best to print figures at the final publication size, and check their quality that way.

Use absolute measurements

Most of the problems I had with this stem from the fact that Mathematica uses both absolute and relative (to the plot size) measurements. For figures that will appear in print, it's easiest to use absolute sizes that do not scale with the plot, in particular for font sizes and for line thickness. This way you can have a good idea about what the result will look like in print (and it will be independent of figure size). The numbers you give to Mathematica are in printer's points.

Exporting

Finally, I found that exporting to EPS is less reliable than exporting to PDF (e.g. fonts might not be embedded, as you mentioned), and Mathematica is unable to preserve all features (e.g. opacity!) when exporting to EPS. For 2D plots PDF is usually a good choice. However, there's a bug when exporting PDF's and specifying the ImageSize in Export. The workaround I use is

cm = 72/2.54 (* centimetres *)
Export["figure.pdf", Show[figure, ImageSize -> 7 cm]] (* 7 cm wide figure *)

The you can include the result in the paper without any scaling, and you'll have consistent font sizes and line thicknesses throughout all figures.

In summary, this has more or less worked for me:

  1. use absolute measurements for things that need to be consistent across figures in print
  2. export to PDF, with the intended final size, and don't rescale the result before including it (e.g. don't specify a width in LaTeX)


I substituted FontFamily -> "Helvetica" and exported to PDF. Opening that PDF in Foxit Reader I see this:

Exporting graphics for publications: how to achieve consistent line thicknesses in plot elements?

Other than different zoom (not sure why) it looks quite similar to your rendering.


I'd look closely at LevelScheme, which I have used for publication quality graphics.

0

精彩评论

暂无评论...
验证码 换一张
取 消