I have some function that takes some parameters and then produces a plot which I then save somewhere on my computer. I don't want to keep the lines of input and output which produce and show the plot in the notebook, because its messy and also slows down the running of the notebook.

Does any one have any good practices for saving information on the plot, so that I could reproduce it in the future or so I could understand exactly what it shows without referring to the Mathematica file?

I'm thinking write a text file that lists the parameters used, and gives a link to the Mathematica notebook / a code snippet something like that?

Apologies for a poorly worded and very soft question.

  • 1
    $\begingroup$ Why not maintain two versions: one with, and one without, the input that generated the plots? $\endgroup$ – J. M. will be back soon Oct 10 '18 at 10:19
  • $\begingroup$ I'm not entirely sure I understand, but you could make an image out of a table showing the parameters and the plot, Export["bookkeekping.pdf",Column[{TableForm[parameters],plot}]] or something, with the original file name in the list of parameters and then just crop out the table when you want to use the plot for a presentation or something. $\endgroup$ – N.J.Evans Oct 10 '18 at 12:51
  • $\begingroup$ You might also look at automated reports in the docs, which may be too heavy for what you want, but maybe something useful will stand out. $\endgroup$ – N.J.Evans Oct 10 '18 at 12:53
  • $\begingroup$ Some tools you might use are LocalObject, Iconize, BoxForm`ArrangeSummaryBox, and perhaps DumpSave. You could store data and metadata in an Association. Hold[code] is useful for keeping code from executing. $\endgroup$ – Michael E2 Oct 10 '18 at 14:27

Did you know that you can hide input cells? See this:


More flexibly, Iconize was introduced with these type of thoughts. The cool image below is made with this simple line of code:

enter image description here

enter image description here

where blue field is hiding numerous options (as it says, 20 options):

SphericalPlot3D[1 ,{u,0,Pi},{v, 0,2Pi}, 
    Lighting->{{"Ambient", White}},

It was made very easily with the context menu access to Iconize:

enter image description here

As to input cells making things slow - I doubt it is that bad, as most of them just text. Also I believe in some cases Iconize will help with that too, if it hides, for instance, some rich front-end things like images or entities.

You can also Iconize the whole input, naming it as a memo meaningfully, for example:

    FinancialData["IBM","Jan. 1, 2004"],
    FinancialData["APPL","Jan. 1, 2004"],
    FinancialData["MSFT","Jan. 1, 2004"]},
"IBM vs Apple vs Microsoft"]

which will give you a copiable object that gives plot upon evaluation:

enter image description here


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.