{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Rasterization for vector graphics\n\nRasterization converts vector graphics into a raster image (pixels). It can\nspeed up rendering and produce smaller files for large data sets, but comes\nat the cost of a fixed resolution.\n\nWhether rasterization should be used can be specified per artist. This can be\nuseful to reduce the file size of large artists, while maintaining the\nadvantages of vector graphics for other artists such as the Axes\nand text. For instance a complicated `~.Axes.pcolormesh` or\n`~.Axes.contourf` can be made significantly simpler by rasterizing.\nSetting rasterization only affects vector backends such as PDF, SVG, or PS.\n\nRasterization is disabled by default. There are two ways to enable it, which\ncan also be combined:\n\n- Set `~.Artist.set_rasterized` on individual artists, or use the keyword\n argument *rasterized* when creating the artist.\n- Set `.Axes.set_rasterization_zorder` to rasterize all artists with a zorder\n less than the given value.\n\nThe storage size and the resolution of the rasterized artist is determined by\nits physical size and the value of the ``dpi`` parameter passed to\n`~.Figure.savefig`.\n\n
The image of this example shown in the HTML documentation is not a vector\n graphic. Therefore, it cannot illustrate the rasterization effect. Please\n run this example locally and check the generated graphics files.