I would like to extract some pictures from a Manipulate
that uses a slider, but when I do it from the pop-up menu, I get all the frame and slider with it. How can we export the picture (to PNG, say), for a given slider value (say $k = 0.5$, for the example below), without the Manipulate frame, slider, and even without the axes and ticks?
And probably trickier: how can we extract the graphics with an higher resolution than what the Manipulate shows? (say 1024 x 1024 pixels in PNG format, instead of the lower resolution of 600 below).
Here's a semi-cool MWE to play with:
Manipulate[
ContourPlot[
Cos[x + y] Sin[k x - 3 y],
{x, -2, 2},
{y, -2, 2},
PlotPoints -> 20,
PlotRange -> {{-2, 2}, {-2, 2}},
Axes -> True,
AxesOrigin -> {0, 0},
AxesStyle -> Directive[GrayLevel[0.5]],
AxesLabel -> {
Style["X", Bold, 14],
Style["Y", Bold, 14]
},
ColorFunction -> "Rainbow",
ContourStyle -> Black,
Contours -> Automatic,
ImageSize -> 600
],
{
k, -5, 5, 0.1,
ImageSize -> Large,
Appearance -> {"Labeled", "Closed"},
AppearanceElements -> {"InputField", "Slider"}
},
ControlPlacement -> Bottom,
FrameMargins -> None,
FrameLabel -> {None, None,
Style["Some Funny Title", Bold, 14, FontFamily -> "Helvetica"]}
]
Export
on the copied graphics. $\endgroup$Manipulate[plt = ContourPlot[...], ...]
. Then, when you change your sliders, the new image is stored toplt
. Then,Export["path/plot.png", plt, ImageSize -> {1024, 1024}]
. The resolution in your code isn't 600, that's just a width (well, I suppose it might end up being the resolution if there are no other options given on export). I usually choose a target resolution when exporting and ignore the size likeExport["path/plot.png", plt, ImageResolution -> 300]
. $\endgroup$TrackedSymbols
in @MassDefect 's solution, or you'll recompute the plot. $\endgroup$