Python - 减少绘图轴的大小

时间:2021-04-13 09:53:00

标签: python matplotlib

我想缩小我绘制的这张图的轴尺寸。如您所见, (0.7 ; 1.0) 部分在两个轴上都无用,我想删除它们,以便图表居中并占据所有情节。

enter image description here

这是我的绘图代码的一部分:


# Annotating the plot.

plt.plot(U, V, 'o-', color='white', mec='black')
plt.annotate(patch_sd.name.title(),
             xy=UV,
             xytext=(-50, 30),
             textcoords='offset points',
             arrowprops=dict(arrowstyle='->', connectionstyle='arc3, rad=0.2'))

# Displaying the plot.

render(
    standalone=True,
    limits=(-0.1, 0.9, -0.1, 0.9),
    x_tighten=True,
    y_tighten=True)

谢谢!

1 个答案:

答案 0 :(得分:1)

plt.xlim(0, 0.5)
plt.ylim(0, 0.5)