开发者

How to save figures to pdf as raster images in matplotlib

I have some complex graphs开发者_StackOverflow made using matplotlib. Saving them to a pdf using the savefig command uses a vector format, and the pdf takes ages to open. Is there any way to save the figure to pdf as a raster image to get around this problem?


You can force individual figure elements to be rasterized like this:

text(1,1,'foobar',rasterized=True)


Not that I know, but you can use the 'convert' program (ImageMagick') to convert a jpg to a pdf: `convert file.jpg file.pdf'.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜