I often use Mathematica notebooks as an informal "lab notebook", plotting recent results in various tabs and such. I've noticed that these files can tend to get really large; for example, my Windows file explorer shows one to be 66MB. Additionally, it can often take about 10 seconds to finish saving a file. It also tends to be a little "laggy" when I scroll around the plots or open/close the tabs (the alt+5 titles that you can collapse) that I use to organize my work.

My first question is: What's causing such a delay? I suspect it's either just having many large datasets (~100,000 pairs) in memory, or maybe it is that when I plot them, the data is still "there"; i.e., the plot isn't just a static image or something.

My second question is: Is there a smarter way I should be doing this? My main concern is usually just producing the plots so I can analyze my data quickly. If it would be faster to raster them so they were just a simple image, that wouldn't bother me.

What's the smartest way to do this? Thank you!

  • 1
    $\begingroup$ related: 71575, 6157, 13978 $\endgroup$
    – Kuba
    Commented May 10, 2017 at 18:42

1 Answer 1


Is rasterization going to make the notebooks smaller? It depends on the specific graphics. The documentation tools in Workbench will rasterize only those plots which actually become smaller in raster form.

I have not delved deep into this, but I think a way to make a rough estimate of the size is this:


I noticed that graphics that are large tend to be stored in a compressed form in the notebook, so I tried to emulate the same.

If you try this for graphics = Graphics[Disk[]] then the vector form is much smaller, obviously. If you try it for graphics = Plot[Sin[x], {x, 0, 10}] then the raster form is smaller.

But rasterizing has drawbacks too: the image won't scale well anymore, and will look pretty bad on high-resolution ("retina") screens. This is why I do not like to rasterize (I use a retina Mac).

Regarding laggy scrolling: rasterizing often helps. I often rasterize for this reason. Try this with 100000 points, and rasterization becomes a must. I prefer the following function because it produces sharp images on a retina screen:

rast = Image[Rasterize[#, "Image", RasterSize -> 2 72], Magnification -> 1/2] &
  • $\begingroup$ My general approach is to break up files into smaller linked files, as needed, but (as they say) "your mileage may vary." $\endgroup$ Commented May 10, 2017 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.