|
From: Slavin, J. <js...@cf...> - 2014-03-25 15:45:43
|
I think what the responders have in mind is simply outputting files in a different format, e.g. png, which is rasterized. One alternative you might consider is using code written by Tom Robataille called rasterized_scatter. It automatically rasterizes your data points. You can find it on github. Jon On Sat, Mar 22, 2014 at 4:39 PM, < mat...@li...> wrote: > From: Christopher Kuhlman <cku...@vb...> > To: Goyo <goy...@gm...> > Cc: matplotlib-users <mat...@li...> > Date: Sat, 22 Mar 2014 16:38:59 -0400 (EDT) > Subject: Re: [Matplotlib-users] how to reduce the file size of plots > generated with matplotlib > Thank you both for your fast replies. (Just an aside, plotting all the > points is a quick way to detect outliers.) > > Before I sent the email, I tried to find a simple raster command in > matplotlib to do just that (convert the image to raster), but I could not > find one in my search. Is there such a thing? > > Thanks again. > > c > > ----- Original Message ----- > From: "Goyo" <goy...@gm...> > To: "Christopher Kuhlman" <cku...@vb...> > Cc: "matplotlib-users" <mat...@li...> > Sent: Saturday, March 22, 2014 4:11:08 PM > Subject: Re: [Matplotlib-users] how to reduce the file size of plots > generated with matplotlib > > 2014-03-22 20:23 GMT+01:00 Christopher Kuhlman <cku...@vb...>: > [...] > > For example, most recently, I am plotting 3 data sets; each data set has > about 90,000 points. If I plot all three sets in one PDF figure, the file > size is over 2MB. > > This seems absurd to me. I used R plotting for many years (again, my > own homegrown code, for 6 years) and never had this issue, and I was making > these kinds of plots/figures. > > > > I thought it may be a vector/raster issue, but the following web page > says that PDF are generated as vector image, which, to my understanding > (which could be wrong), is the more compact format. > > http://matplotlib.org/faq/usage_faq.html > [...] > > Roughly speaking, size of vector files depend on the number of points > while size of raster files depends on the number of pixels. For your > use case (many points, small images) raster output should be more > compact. > > Goyo > -- ________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA js...@cf... 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 fax: (617) 496-7577 USA ________________________________________________________ |