4
$\begingroup$

I'm having issues in saving out a plot with another plot inset within it. Here is a basic example.

theInsetPlot = Plot[Sin[x], {x, 0, 6 Pi}];

plotWithInset = Plot[Sin[x], {x, 0, 6 Pi}, PlotRange -> {{0, 6 Pi}, {-10, 30}}, Epilog ->{Inset[theInsetPlot, {7, 15}]}]

This gives me a plot with an inset plot. If I right click the image and use "save graphics as.." to save out a .jpeg I get the following. Which matches the notebook output image.

Plot when manually exporting as a jpeg (same for other formats)

However, if I rasterise the image

Rasterize[plotWithInset]

or save out with the following code

Export[NotebookDirectory[] <> "testPlotAuto.jpeg", plotWithInset]

I get this image

Plot when exporting with code and/or rasterizing

As you can see, the inset graph is scaled weirdly. This is the same for all of the different output formats I have tried.

My actual example is are complicated, but this minimal example shows the problem.

I'm on: "12.1.1 for Mac OS X x86 (64-bit) (June 19, 2020)"

$\endgroup$
2
$\begingroup$

Confirmed as a bug by Wolfram Tech Support. The following are workarounds until it is fixed.

For Rasterising

Rasterize@Framed[plotWithInset, FrameStyle -> None]

For Exporting

Export[NotebookDirectory[] <> "testPlotAuto1.jpeg", Framed[plotWithInset]]

$\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.