clawpack / visclaw

Clawpack visualization tools
http://www.clawpack.org
BSD 3-Clause "New" or "Revised" License
29 stars 48 forks source link

rasterize figures by default #286

Closed Thomas-Ulrich closed 2 years ago

Thomas-Ulrich commented 2 years ago

as discussed in https://github.com/clawpack/visclaw/issues/284

mandli commented 2 years ago

I tested this a bit as I was not sure what would happen if you had kwargs = {"rasterized":False} and it look like it works. It would be good to document this somewhere although I imagine that there are very few times this would not be the desired behavior for pcolor plots. Are the other plot types (e.g. imshow) also rasterized by default? Are there other plots we may want to rasterize?

rjleveque commented 2 years ago

Thanks @Thomas-Ulrich, this is very useful. I agree we should document this since it wasn't clear to me at first how to use it, but I think idea is that if the pcolor plot is made this way, you can then do savefig('filename.svg'), for example, and it saves an svg file in which the labels use vector graphics but the field plotted is still rasterized.

I tried a quick experiment and the rasterized=True option can also be added to imshow commands with similar advantage, although the svg file made without this option is already much smaller than one made with pcolor.

mandli commented 2 years ago

I definitely think we should default to rasterization when it makes sense.

rjleveque commented 2 years ago

I will open a separate PR for imshow.