How to save figures to pdf as raster images in mat

2019-01-23 05:38发布

I have some complex graphs 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?

2条回答
我命由我不由天
2楼-- · 2019-01-23 05:59

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

text(1,1,'foobar',rasterized=True)
查看更多
趁早两清
3楼-- · 2019-01-23 06:15

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

查看更多
登录 后发表回答