question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to rasterize large scatter plots?

See original GitHub issue

Hi, is there an option to rasterize scatter plot? Something like rasterized=True in matplotlib: https://brushingupscience.com/2017/05/09/vector-and-raster-in-one-with-matplotlib/

For reference, I’m currently writing PDF’s with ~ 500MB size per figure…

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
has2k1commented, Jan 29, 2020

@Hoeze, I will consider it, may be the realise after the next one.

1reaction
has2k1commented, Jan 20, 2020

You can drop into matplotlib to do it.

from plotnine import *
from plotnine.data import mtcars

p = (ggplot(mtcars, aes('wt', 'mpg'))
     + geom_point()
     + geom_smooth()
)

# Get figure and access the points to be rasterized
fig = p.draw()
points = fig.axes[0].collections[0]
points.set_rasterized(True)
fig.savefig('raster_points.pdf')
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to partially rasterize a figure plotted with R
Now we must figure out how big our plot area actually is. To do so, use the par function to extract the plot...
Read more >
Selective Raster Graphics - Department of Statistics
The grid.rasterize function works by creating a raster version of only a specific sub-region of a plot. An alternative approach is to rasterize...
Read more >
Rasterization for vector graphics - Matplotlib
Rasterization converts vector graphics into a raster image (pixels). It can speed up rendering and produce smaller files for large data sets, ...
Read more >
How to create fast and accurate scatter plots with lots of data ...
datashader is a great library to visualize larger datasets. The main improvement comes from the rasterization process: matplotlib will create a ...
Read more >
Slim down your bloated graphics - AstroBetter
My favorite solution is to use the rasterized keyword in the matplotlib plot function. Points are rasterized, but text and line art remain ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found