简体   繁体   English

在 matplotlib.pyplot 中缩放?

[英]Scaling in matplotlib.pyplot?

I am generating planar coordinates within the range (x,y) in [0,500]x[0,500].我在 [0,500]x[0,500] 中生成范围 (x,y) 内的平面坐标。 When using matplotlib.pyplot to visualize them, the axes only show the part that contains already generated points.使用matplotlib.pyplot将它们可视化时,轴仅显示包含已生成点的部分。 How can I scale the axes so that they correspond to [0,500]x[0,500]?如何缩放轴,使它们对应于 [0,500]x[0,500]?

This is what I have for now:这就是我现在所拥有的:

在此处输入图片说明

使用ax.set_xlim([0, 500])set_ylim

You can set the row and column size of the plot area by the following..您可以通过以下方式设置绘图区域的行和列大小。

import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (10,5)

But the figure.figsize accepts the parameter in inches, so if you need it to be in other units, then adjust the parameter by converting from inches to your desired unit.但是figure.figsize接受以英寸为单位的参数,因此如果您需要使用其他单位,请通过将英寸转换为所需单位来调整参数。

Hope this helps.希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM