Search code examples
idl-programming-language

Is there a way to save and quickly reopen surface plots in IDL (Interactive Data Language)?


I was wondering if there is a way to save surface plots in IDL in a way that is convenient to reopen them. As far as I am aware there are only two ways of doing this:

  • The first way is to save your surface plot as an image e.g. png. The trouble with this is that the viewing angle is fixed and you can no longer drag with the mouse to rotate the surface plot.
  • The second way is to save the code which generates the plot. Trouble with this is the code often generates loads of plots which are usually just saved as images.

I would like something you can open easily and which opens the surface plot as though you had just run the code to generate it. So that you are free to rotate it by dragging the mouse.

Does this exist?

I only have IDL version 8.3.


Solution

  • If you 'Generate code/save data' (either via the toolbar at the bottom of the window or via the generateCode method with the SAVEDATA keyword), you get a .sav file that contains your plot. Either use the code generated to restore it, or use the generated code as an example to write your own.