您现在的位置是:主页 > news > 东莞网站设计定制开发/重庆seo技术

东莞网站设计定制开发/重庆seo技术

admin2025/6/4 3:01:44news

简介东莞网站设计定制开发,重庆seo技术,邢台做外贸网站,如何给网站做引流Matplotlib是Python中的一个库,它是数字的-NumPy库的数学扩展。 Figure模块提供了顶层Artist,即Figure,其中包含所有绘图元素。此模块用于控制所有图元的子图和顶层容器的默认间距。matplotlib.figure.Figure.subplots_adjust()方法matplotli…

东莞网站设计定制开发,重庆seo技术,邢台做外贸网站,如何给网站做引流Matplotlib是Python中的一个库,它是数字的-NumPy库的数学扩展。 Figure模块提供了顶层Artist,即Figure,其中包含所有绘图元素。此模块用于控制所有图元的子图和顶层容器的默认间距。matplotlib.figure.Figure.subplots_adjust()方法matplotli…

Matplotlib是Python中的一个库,它是数字的-NumPy库的数学扩展。 Figure模块提供了顶层Artist,即Figure,其中包含所有绘图元素。此模块用于控制所有图元的子图和顶层容器的默认间距。

matplotlib.figure.Figure.subplots_adjust()方法

matplotlib库的subplots_adjust()方法图形模块用于用kwarg更新SubplotParams。

用法:subplots_adjust(self, left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)

参数:此方法接受下面讨论的以下参数:

left:此参数是该图子图的左侧。

right:此参数是该图子图的右侧。

bottom:此参数是该图子图的底部。

top:此参数是该图子图的顶部。

wspace:此参数是为子图之间的空间保留的宽度量,表示为平均轴宽度的一部分。

hspace:此参数是为子图之间的空间保留的高度量,表示为平均轴高度的一部分。

返回值:此方法不返回任何值。

以下示例说明了matplotlib.figure中的matplotlib.figure.Figure.subplots_adjust()函数:

范例1:

# Implementation of matplotlib function

import numpy as np

import matplotlib.pyplot as plt

x = [1, 2, 3, 4]

y = [1, 4, 9, 16]

fig = plt.figure()

axs = fig.subplots()

axs.plot(x, y)

fig.subplots_adjust(bottom = 0.15)

fig.suptitle("""matplotlib.figure.Figure.subplots_adjust()

function Example\n\n""", fontweight ="bold")

fig.show()

输出:

   referrerpolicy=

范例2:

# Implementation of matplotlib function

import numpy as np

import matplotlib.pyplot as plt

from matplotlib.widgets import TextBox

fig, ax = plt.subplots()

fig.subplots_adjust(bottom = 0.2)

t = np.arange(-2.0, 2.0, 0.001)

s = np.sin(t)+np.cos(2 * t)

initial_text = "sin(t) + cos(2t)"

l, = ax.plot(t, s, lw = 2)

def submit(text):

ydata = eval(text)

l.set_ydata(ydata)

ax.set_ylim(np.min(ydata), np.max(ydata))

plt.draw()

axbox = plt.axes([0.4, 0.05, 0.3, 0.075])

text_box = TextBox(axbox, 'Formula Used:',

initial = initial_text)

text_box.on_submit(submit)

fig.suptitle("""matplotlib.figure.Figure.subplots_adjust()

function Example\n\n""", fontweight ="bold")

fig.show()

输出:

   referrerpolicy=