Python中的 matplotlib.axes.Axes.loglog()
Matplotlib是Python中的一个库,它是 NumPy 库的数值数学扩展。 Axes 类包含大部分图形元素:Axis、Tick、Line2D、Text、Polygon 等,并设置坐标系。 Axes 的实例通过回调属性支持回调。
matplotlib.axes.Axes.loglog()函数
matplotlib 库的 axes 模块中的Axes.errorbar()函数用于在 x 和 y 轴上绘制对数缩放的绘图。
Syntax:
Parameters: This method accept the following parameters that are described below:
- basex, basey: These parameter are Base of the x/y logarithm and are optional with default value 10.
- subsx, subsy: These parameter are the sequence of location of the minor x/y ticks and are optional.
- nonposx, nonposy: These parameter are non-positive values in x or y that can be masked as invalid, or clipped to a very small positive number.
Returns: This returns the following:
- lines:This returns the list of Line2D objects representing the plotted data..
下面的示例说明了 matplotlib.axes 中的 matplotlib.axes.Axes.loglog()函数:
示例 1:
Axes.loglog(self, *args, **kwargs)
输出:
示例 2:
# Implementation of matplotlib function
import numpy as np
import matplotlib.pyplot as plt
t = np.arange(0.01, 20.0, 0.01)
# Create figure
fig, ax = plt.subplots()
# log x and y axis
ax.loglog(t, 20 * np.exp(-t / 10.0), basex = 2)
ax.set_title('matplotlib.axes.Axes.loglog Example2')
plt.show()
输出: