Is there a way to generate Retina graphs using 'matplotlib'?

巧了我就是萌 提交于 2019-12-22 11:01:26

问题


Python's matplotlib does not generate Retina display quality LaTeX text by default. Are there settings or add-on package that generate Retina quality output?


回答1:


Are you using 'Agg' mode (standard) to create PNG Graphs?

You can create SVG Graphs with Matplot lib which have way better quality using

matplotlib.use('svg')



回答2:


If you look into texmanager.py you see that it makes the png by a call to dvipng and the function that makes the system call to dvipng has an argument for dpi

To get higher resolution TeX on a per-figure basis for existing figures

plt.gcf().canvas.renderer.dpi = what_ever_retina_dpi_is

to set it everywhere, you should be able to set the rcparam figure.dpi which will be respected when creating new renderers.

I can't test this as I do not have access to a Mac with a Retina display.



来源:https://stackoverflow.com/questions/20193328/is-there-a-way-to-generate-retina-graphs-using-matplotlib

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