CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual use to large groups and classes! Also, H100 GPUs starting at $2/hour.
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual use to large groups and classes! Also, H100 GPUs starting at $2/hour.
Image: ubuntu2204-dev
SVG or PNG plots in CoCalc Notebooks
Type | pros | cons |
---|---|---|
SVG | higher resolution | size and rendering time proportional to number of elements |
PNG | screen resolution, could be 2x oversampled for high res monitors | constant size, proportional to number of pixels and overall complexity, constant rendering time |
NOTE: This is for the Python 3 kernel. It does not work for the SageMath kernels. See 35972.
Default: PNG plots with 2x oversampling ("retina")
This is configured by default on CoCalc via
This plot has a size of about 142kB and works well on modern high resolution screens.
... or as just a simpler PNG without oversampling, with a size of just about 60kB. If you have a high resolution screen, you'll notice fuzziness around sharp edges and characters.
SVG
Configure the backend for drawing inline plots to use SVG
The plot below has a size of only 27kB.
10.000 points?
Here, SVG grows larger than PNG.
Warning If you up this to 100.000 and plot SVG, your browser might eat up a lot of your computers resources, since it has to draw so much!
This PNG plot has about 110kB.
While this SVG is more than 1MB (compressed it is less, though), and it takes a bit to even render it in your browser. With more elements to draw, the local performance of showing this SVG will suffer even more, while the performance of rendering a PNG is essentially constant.