5
$\begingroup$

I have noticed that when I export something with an Inset objects,

pp[t_] :=  
  Plot[Sin[x], {x, -10, 10},
    Epilog -> 
      {Inset[
         Framed[
           Text[Style[HoldForm["t=" t], 20]], 
           RoundingRadius -> 4, Background -> White], 
         Scaled[{.5, .5}]]}, 
    Frame -> True]

When I increase the ImageResolution, the border of the inset becomes thicker. Here is what I see:

Export["/Users/xx/Desktop/ContC1.png", pp[12], ImageResolution -> 250]

enter image description here

Whereas, if I keep ImageResolution lower, the thickness of the inset is more reasonable.

What is happening?

$\endgroup$
1
  • $\begingroup$ Probably you use Mathematica version lower than 10.4.1 because my tests with versions 10.4.1 and 11.1.0 on Windows 7 x64 showed that ImageResolution is simply ignored by Export. Note that ImageResolution (at least in version 10.0 where it works at all) isn't working as it is supposed to. Which version do you use? $\endgroup$ Mar 19, 2017 at 6:03

2 Answers 2

2
$\begingroup$

Unfortunately Mathematica's vector graphics isn't resolution-independent by default and making it resolution-independent it rather tricky and usually doesn't worth the efforts.

I recommend to Export the plot as PDF or SVG and then use Adobe Acrobat (or other PDF rendered) or Inkscape for producing a raster image. This method has many advantages:

  • Much more precise rendering of graphical primitives than what Mathematica's FrontEnd offers (FrontEnd rounds everything to screen pixels).

  • You can specify any resolution you want, and the plot won't change with resolution!

  • Mathematica's FrontEnd takes a HUGE amount of memory when it renders graphics with high resolution and it's maximum resolution is limited [1,2]. To the contrary, Adobe Acrobat takes a reasonable amount of memory when saving PDF as PNG image and virtually has no limit on resolution.

And do not stick to rasters, you can Export your plot directly into a resolution-independent vector format: PDF, EPS, SVG and EMF are available! Many scientific journals prefer vector formats for figures and any modern desktop publishing software supports a subset of these formats.

$\endgroup$
0
$\begingroup$

Make it image before exporting.

Image@Rasterize@pp@12
$\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.