<tfoot id='aC9Ij'></tfoot>
    <bdo id='aC9Ij'></bdo><ul id='aC9Ij'></ul>
<i id='aC9Ij'><tr id='aC9Ij'><dt id='aC9Ij'><q id='aC9Ij'><span id='aC9Ij'><b id='aC9Ij'><form id='aC9Ij'><ins id='aC9Ij'></ins><ul id='aC9Ij'></ul><sub id='aC9Ij'></sub></form><legend id='aC9Ij'></legend><bdo id='aC9Ij'><pre id='aC9Ij'><center id='aC9Ij'></center></pre></bdo></b><th id='aC9Ij'></th></span></q></dt></tr></i><div id='aC9Ij'><tfoot id='aC9Ij'></tfoot><dl id='aC9Ij'><fieldset id='aC9Ij'></fieldset></dl></div>

  1. <legend id='aC9Ij'><style id='aC9Ij'><dir id='aC9Ij'><q id='aC9Ij'></q></dir></style></legend>
    1. <small id='aC9Ij'></small><noframes id='aC9Ij'>

      以非常高的质量在 Python 中保存图像

      时间:2023-10-19

        • <bdo id='z8YdB'></bdo><ul id='z8YdB'></ul>
          <legend id='z8YdB'><style id='z8YdB'><dir id='z8YdB'><q id='z8YdB'></q></dir></style></legend>

                <i id='z8YdB'><tr id='z8YdB'><dt id='z8YdB'><q id='z8YdB'><span id='z8YdB'><b id='z8YdB'><form id='z8YdB'><ins id='z8YdB'></ins><ul id='z8YdB'></ul><sub id='z8YdB'></sub></form><legend id='z8YdB'></legend><bdo id='z8YdB'><pre id='z8YdB'><center id='z8YdB'></center></pre></bdo></b><th id='z8YdB'></th></span></q></dt></tr></i><div id='z8YdB'><tfoot id='z8YdB'></tfoot><dl id='z8YdB'><fieldset id='z8YdB'></fieldset></dl></div>
              • <small id='z8YdB'></small><noframes id='z8YdB'>

              • <tfoot id='z8YdB'></tfoot>

                  <tbody id='z8YdB'></tbody>

                本文介绍了以非常高的质量在 Python 中保存图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                如何以非常高的质量保存 Python 绘图?

                How can I save Python plots at very high quality?

                也就是说,当我不断放大保存在 PDF 文件中的对象时,为什么没有任何模糊?

                That is, when I keep zooming in on the object saved in a PDF file, why isn't there any blurring?

                另外,保存它的最佳模式是什么?

                Also, what would be the best mode to save it in?

                png, eps?还是其他?我不能做 pdf,因为有一个隐藏的数字发生在 Latexmk 编译中.

                png, eps? Or some other? I can't do pdf, because there is a hidden number that happens that mess with Latexmk compilation.

                推荐答案

                如果你使用的是 Matplotlib 并试图在 LaTeX 文档中获得好的数字,另存为 EPS.具体来说,在运行命令绘制图像后尝试这样的操作:

                If you are using Matplotlib and are trying to get good figures in a LaTeX document, save as an EPS. Specifically, try something like this after running the commands to plot the image:

                plt.savefig('destination_path.eps', format='eps')
                

                我发现 EPS 文件效果最好,而 dpi 参数才是真正让它们在文档中看起来不错的原因.

                I have found that EPS files work best and the dpi parameter is what really makes them look good in a document.

                要在保存之前指定图形的方向,只需在 plt.savefig 调用之前调用以下命令,但在创建绘图之后(假设您使用名称为 的轴进行绘图斧头):

                To specify the orientation of the figure before saving, simply call the following before the plt.savefig call, but after creating the plot (assuming you have plotted using an axes with the name ax):

                ax.view_init(elev=elevation_angle, azim=azimuthal_angle)
                

                其中 elevation_angle 是一个数字(以度为单位),指定极角(从垂直 z 轴向下),azimuthal_angle 指定方位角(围绕 z 轴).

                Where elevation_angle is a number (in degrees) specifying the polar angle (down from vertical z axis) and the azimuthal_angle specifies the azimuthal angle (around the z axis).

                我发现最容易确定这些值的方法是首先绘制图像,然后旋转它并观察当前角度值出现在窗口底部,就在实际绘图下方.请记住,默认情况下会显示 x、y、z 位置,但是当您开始单击+拖动+旋转图像时,它们会替换为两个角度.

                I find that it is easiest to determine these values by first plotting the image and then rotating it and watching the current values of the angles appear towards the bottom of the window just below the actual plot. Keep in mind that the x, y, z, positions appear by default, but they are replaced with the two angles when you start to click+drag+rotate the image.

                这篇关于以非常高的质量在 Python 中保存图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何使用 PIL 保存图像? 下一篇:Django:何时自定义保存与使用保存后信号

                相关文章

                <legend id='cHGxu'><style id='cHGxu'><dir id='cHGxu'><q id='cHGxu'></q></dir></style></legend>

              • <small id='cHGxu'></small><noframes id='cHGxu'>

                <i id='cHGxu'><tr id='cHGxu'><dt id='cHGxu'><q id='cHGxu'><span id='cHGxu'><b id='cHGxu'><form id='cHGxu'><ins id='cHGxu'></ins><ul id='cHGxu'></ul><sub id='cHGxu'></sub></form><legend id='cHGxu'></legend><bdo id='cHGxu'><pre id='cHGxu'><center id='cHGxu'></center></pre></bdo></b><th id='cHGxu'></th></span></q></dt></tr></i><div id='cHGxu'><tfoot id='cHGxu'></tfoot><dl id='cHGxu'><fieldset id='cHGxu'></fieldset></dl></div>

                  <bdo id='cHGxu'></bdo><ul id='cHGxu'></ul>

                    <tfoot id='cHGxu'></tfoot>