Matplotlib: how to load and show a PDF image

点点圈 提交于 2021-01-27 04:00:17

问题


My problem is simple: I have a PDF figure I would like to show alongside the results of some data analysis. Yet even an extensive Google search did not bring up a way to load and show a PDF in a figure (I only found the standard results for raster images like JPG or PNG).

Thanks in advance!


回答1:


I don't think Matplotlib supports plotting imported vector graphics on its own as of today.

The easiest approach would probably be to save your figure generated in Matplotlib to SVG, convert your PDF to svg (pdf2svg works well most of the time) and the combine the two SVGs in a second step, for instance using svg_utils. Note that you can do all this in a single script.



来源:https://stackoverflow.com/questions/22747853/matplotlib-how-to-load-and-show-a-pdf-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!