Exporting the axis area only in bitmap with matplotlib python

advertisements

for scientific conferences, the file size of papers is usually limited. I like to include my plots as pdfs, so text and lines stay crisp. When I create false colour plots or scatter plots with lots of data though, the exported pdf easily gets larger than the full paper is allowed to be.

Is there a way I could export only the axis area to bitmap, so I can include it in vector axes later? (or is there a better way to get a pdf with some elements embedded as bitmaps?)

I hope someone could help me here. As it's my first post, comments on how to improve my question are appreciated.


You can tell individual Artists to be exported as rastered in vector output:

img = plt.imshow(...)
img.set_rasterized(True)

(doc)