# How to save and manipulate an already plotted graphic

I have a figure which took some hours to create in Mathematica. I assigned it to a variable myplot, i.e., myplot = Plot[..]. Now I want to turn off my computer, even though the legends in this plot are not as good as I wish. I want to be able to change them later.

In Matlab I used to save the figure as a .fig file. Later I was able to open the .fig file and do any manipulation. How is this done in Mathematica? I dont want to spend hours and hours again to create the same figure with better legends, etc. My main concern is to be able to manipulate the legends of the figure without plotting it again with the new legend definitions.

Here is my try without any success:

Show[myplot, PlotLegends -> SwatchLegend[Placed[LineLegend[{Blue, Red, Green, Orange, Black, Cyan}, {"\!$$\*SubsuperscriptBox[\(\*SubscriptBox[\(I$$, \$$0$$]\), $$c$$,n]\)", "\!$$\*SubsuperscriptBox[\(\*SubscriptBox[\(I$$, $$0$$]\), \$$c$$,m]\)", "\!$$\*SubsuperscriptBox[\(\*SubscriptBox[\(I$$, $$0$$]\), \$$c$$,a]\)", "\!$$\*SubsuperscriptBox[\(\*SubscriptBox[\(I$$, $$0$$]\), \$$c$$,h]\)", "\!$$\*SubsuperscriptBox[\(\*SubscriptBox[\(I$$, $$0$$]\), \$$c$$,c]\)", "\!$$\*SubsuperscriptBox[\(\*SubscriptBox[\(I$$, $$0$$]\), \$$c$$,$$\*SuperscriptBox[\(c$$, $$*$$]\)]\)"}, LabelStyle -> 21, LegendFunction -> (Framed[#, RoundingRadius -> 2, FrameStyle -> LightGray] &)], {Left, Top}]]]


Here is the last lines of ctrl-shift+r

Inset[LineLegend[{RGBColor[0, 0, 1], RGBColor[1, 0, 0], RGBColor[0, 1, 0], RGBColor[1, 0.5, 0], GrayLevel[0], RGBColor[0, 1, 1]}, {"\!$$\*SubsuperscriptBox[\(\*SubscriptBox[\(I$$, $$0$$]\), $$c$$,n]\)", "\!$$\*SubsuperscriptBox[\(\*SubscriptBox[\(I$$, $$0$$]\), $$c$$,m]\)", "\!$$\*SubsuperscriptBox[\(\*SubscriptBox[\(I$$, $$0$$]\), $$c$$,a]\)", "\!$$\*SubsuperscriptBox[\(\*SubscriptBox[\(I$$, $$0$$]\), $$c$$,h]\)", "\!$$\*SubsuperscriptBox[\(\*SubscriptBox[\(I$$, $$0$$]\), $$c$$,c]\)", "\!$$\*SubsuperscriptBox[\(\*SubscriptBox[\(I$$, $$0$$]\), $$c$$,$$\*SuperscriptBox[\(c$$, $$*$$]\)]\)"}, LabelStyle -> 21,
LegendFunction -> (Framed[#1, RoundingRadius -> 2, FrameStyle -> GrayLevel[0.85]] & ), LegendLayout -> "Column"], Scaled[{0.99, 0.99}],
ImageScaled[{1, 1}], BaseStyle -> {FontSize -> Larger}, FormatType -> StandardForm]}, AspectRatio -> 0.7, Axes -> True, AxesLabel -> {Style["t", FontSize -> 21], Style["\!$$\*SubscriptBox[\(I$$, $$0$$]\)", FontSize -> 21]}, AxesOrigin -> {0, 0}, AxesStyle -> Arrowheads[0.03], BaseStyle -> 18, GridLines -> Automatic, GridLinesStyle -> GrayLevel[0.85], ImageSize -> {583., Automatic}, Method -> {}, PlotRange -> {{-0.5128185731395787, 0.9326363149439076}, {-0.00003110239778374659, 1.51579064969476}},


PlotRangeClipping -> True, PlotRangePadding -> {Scaled[0.02], Scaled[0.02]}]

• DumpSave would work for you? – Kuba Nov 4 '14 at 5:18
• If you're working in a Notebook, you should be able to just save the notebook and reopen it. – Rick R Nov 4 '14 at 5:31
• As long as you don't terminate your Plot[...] commands with a semicolon ;, the plots will appear in the frontend. This means that they physically reside in the frontend notebook, rather than the kernel, so when you save and quit, the plot will not be lost, and will still be there when you reopen the notebook. – DumpsterDoofus Nov 4 '14 at 15:04
• @RickR and DumpsterDoofus. Yes I know that but I dont know how to do any operation that I want to a figure which is already there. I mean lets say I saved the notebook file and reopen it and I can see the figure right infront of me. Now what must I do to this figure so that its legend is say not at right top side but at left top side. There are 6 curves in the figure and I didnt like the color of one of the curves. I want to just change its color but I dont want to run the Plot operation once again with different parameters. I want to do this over an already created figure. How is it done? – Seyhmus Güngören Nov 4 '14 at 16:30
• @Kuba thanks i think it will allow me to save the graph. I can reload it later but then how to manipulate it with some different figure parameters? – Seyhmus Güngören Nov 4 '14 at 16:39

You can actually change the plot even after it has been finished processing. Example

Plot[Evaluate[{Sin[x], Cos[x]}], {x, 0, 2 Pi}]


Place the cursor on top of the chart itself and press Ctrl-Shift-R You'll see the image convert to a Graphics evaluation. You can operate on this item. Let's say that we saved it under

g = Graphics[{{}, {}, {RGBColor[0.368417, 0.506779, 0.709798],
AbsoluteThickness[1.6], Opacity[1.],
Line[{{1.2822827157509358*...


I can later add new options to the Graphic. Example.

AppendTo[g, LabelStyle -> Directive[Blue, Bold]]


g /. Unevaluated[AxesLabel -> {_, _}] ->

• Note that if the LabelStyle option already appears in g, then appending another one to the list of options will have no effect. Use Show instead of Append. Show will replace the option. – Michael E2 Nov 4 '14 at 20:09