matplotlib.pyplot.subplot_tool

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/asty9000/article/details/88880932

为图像启动一个子图工具窗口。子图工具窗口可以用来调整图像中子图的布局。调用格式如下:

subplot_tool(targetfig=None)

参数

targetfig:可选的,目标图像。为此图像启动子图工具窗口。如果未指定或为None,则为当前图像启动子图工具窗口。

返回值

返回值为matplotlib.widgets.SubplotTool实例。

简单示例

import matplotlib.pyplot as plt

x=[1,2,3]
y=[4,5,6]
fig, axs = plt.subplots(2, 2)
axs[0, 0].plot(x,y)
axs[0, 1].plot(x,y)
axs[1, 0].plot(x,y)
axs[1, 1].plot(x,y)

fig1, axs1 = plt.subplots(2, 2)
axs1[0, 0].plot(x,y)
axs1[0, 1].plot(x,y)
axs1[1, 0].plot(x,y)
axs1[1, 1].plot(x,y)

plt.subplot_tool()
plt.subplot_tool(fig)

plt.show()

运行结果如下,通过调节Figure 3和Figure 4中参数的值,可以分别调整图像Figure2和Figure1中的子图布局:

猜你喜欢

转载自blog.csdn.net/asty9000/article/details/88880932