python6维图_Python Matplotlib.axis.Tick.findobj()用法及代码示例

Matplotlib是Python中的一个库,它是数字的-NumPy库的数学扩展。它是Python中令人惊叹的可视化库,用于数组的2D图,并用于与更广泛的SciPy堆栈配合使用。

Matplotlib.axis.Tick.findobj()功能

matplotlib库的轴模块中的Tick.findobj()函数用于查找艺术家对象。

用法: Tick.findobj(self, match=None, include_self=True)

参数:此方法接受以下参数。

match:此参数是匹配的过滤条件。默认值为无。

include_self:此参数将self包含在要检查是否匹配的列表中。

返回值:此方法返回艺术家(艺术家列表)。

以下示例说明了matplotlib.axis中的matplotlib.axis.Tick.findobj()函数:

范例1:

Python3

# Implementation of matplotlib function

from matplotlib.axis import Tick

import matplotlib.pyplot as plt

from matplotlib.lines import Line2D

import numpy as np

from numpy.random import rand

fig, ax2 = plt.subplots()

ax2.bar(range(10), rand(10), picker = True)

print("Value return:\n",

*list(Tick.findobj(ax2)), sep ="\n")

fig.suptitle("""matplotlib.axis.Tick.findobj()

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

plt.show()

输出:

47d9904d3f11809c573a1193e8c569a2.png

Value return:

Rectangle(xy=(-0.4, 0), width=0.8, height=0.787316, angle=0)

Rectangle(xy=(0.6, 0), width=0.8, height=0.901399, angle=0)

Rectangle(xy=(1.6, 0), width=0.8, height=0.783699, angle=0)

Rectangle(xy=(2.6, 0), width=0.8, height=0.516764, angle=0)

Rectangle(xy=(3.6, 0), width=0.8, height=0.284635, angle=0)

Rectangle(xy=(4.6, 0), width=0.8, height=0.228809, angle=0)

Rectangle(xy=(5.6, 0), width=0.8, height=0.347976, angle=0)

Rectangle(xy=(6.6, 0), width=0.8, height=0.311647, angle=0)

Rectangle(xy=(7.6, 0), width=0.8, height=0.0261189, angle=0)

Rectangle(xy=(8.6, 0), width=0.8, height=0.921416, angle=0)

Spine

Spine

Spine

Spine

Text(0.5, 0, '')

Text(1, 0, '')

Line2D()

Line2D()

Line2D((0,0),(0,1))

Text(0, 0, '')

Text(0, 1, '')

Line2D()

Line2D()

Line2D((0,0),(0,1))

Text(0, 0, '')

Text(0, 1, '')

Line2D()

Line2D()

Line2D((0,0),(0,1))

Text(0, 0, '')

Text(0, 1, '')

Line2D()

Line2D()

Line2D((0,0),(0,1))

Text(0, 0, '')

Text(0, 1, '')

Line2D()

Line2D()

Line2D((0,0),(0,1))

Text(0, 0, '')

Text(0, 1, '')

Line2D()

Line2D()

Line2D((0,0),(0,1))

Text(0, 0, '')

Text(0, 1, '')

Line2D()

Line2D()

Line2D((0,0),(0,1))

Text(0, 0, '')

Text(0, 1, '')

XAxis(80.0,52.8)

Text(0, 0.5, '')

Text(0, 0.5, '')

Line2D()

Line2D()

Line2D((0,0),(1,0))

Text(0, 0, '')

Text(1, 0, '')

Line2D()

Line2D()

Line2D((0,0),(1,0))

Text(0, 0, '')

Text(1, 0, '')

Line2D()

Line2D()

Line2D((0,0),(1,0))

Text(0, 0, '')

Text(1, 0, '')

Line2D()

Line2D()

Line2D((0,0),(1,0))

Text(0, 0, '')

Text(1, 0, '')

Line2D()

Line2D()

Line2D((0,0),(1,0))

Text(0, 0, '')

Text(1, 0, '')

Line2D()

Line2D()

Line2D((0,0),(1,0))

Text(0, 0, '')

Text(1, 0, '')

YAxis(80.0,52.8)

Text(0.5, 1.0, '')

Text(0.0, 1.0, '')

Text(1.0, 1.0, '')

Rectangle(xy=(0, 0), width=1, height=1, angle=0)

AxesSubplot(0.125,0.11;0.775x0.77)

范例2:

Python3

# Implementation of matplotlib function

from matplotlib.axis import Tick

import numpy as np

import matplotlib.pyplot as plt

import matplotlib.patches as mpatches

fig, ax = plt.subplots()

x, y = 10 * np.random.rand(2, 1000)

ax.plot(x, y, 'go', alpha = 0.2)

circ = mpatches.Circle((0.5, 0.5), 0.25,

transform = ax.transAxes,

facecolor ='blue',

alpha = 0.75)

ax.add_patch(circ)

print("Value return:\n",

*list(Tick.findobj(ax)), sep ="\n")

fig.suptitle("""matplotlib.axis.Tick.findobj()

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

plt.show()

输出:

5160c891f62ed32ae992424d05e637b9.png

Value return:

Circle(xy=(0.5, 0.5), radius=0.25)

Line2D(_line0)

Spine

Spine

Spine

Spine

Text(0.5, 0, '')

Text(1, 0, '')

Line2D()

Line2D()

Line2D((0,0),(0,1))

Text(0, 0, '')

Text(0, 1, '')

Line2D()

Line2D()

Line2D((0,0),(0,1))

Text(0, 0, '')

Text(0, 1, '')

Line2D()

Line2D()

Line2D((0,0),(0,1))

Text(0, 0, '')

Text(0, 1, '')

Line2D()

Line2D()

Line2D((0,0),(0,1))

Text(0, 0, '')

Text(0, 1, '')

Line2D()

Line2D()

Line2D((0,0),(0,1))

Text(0, 0, '')

Text(0, 1, '')

Line2D()

Line2D()

Line2D((0,0),(0,1))

Text(0, 0, '')

Text(0, 1, '')

Line2D()

Line2D()

Line2D((0,0),(0,1))

Text(0, 0, '')

Text(0, 1, '')

Line2D()

Line2D()

Line2D((0,0),(0,1))

Text(0, 0, '')

Text(0, 1, '')

XAxis(80.0,52.8)

Text(0, 0.5, '')

Text(0, 0.5, '')

Line2D()

Line2D()

Line2D((0,0),(1,0))

Text(0, 0, '')

Text(1, 0, '')

Line2D()

Line2D()

Line2D((0,0),(1,0))

Text(0, 0, '')

Text(1, 0, '')

Line2D()

Line2D()

Line2D((0,0),(1,0))

Text(0, 0, '')

Text(1, 0, '')

Line2D()

Line2D()

Line2D((0,0),(1,0))

Text(0, 0, '')

Text(1, 0, '')

Line2D()

Line2D()

Line2D((0,0),(1,0))

Text(0, 0, '')

Text(1, 0, '')

Line2D()

Line2D()

Line2D((0,0),(1,0))

Text(0, 0, '')

Text(1, 0, '')

Line2D()

Line2D()

Line2D((0,0),(1,0))

Text(0, 0, '')

Text(1, 0, '')

Line2D()

Line2D()

Line2D((0,0),(1,0))

Text(0, 0, '')

Text(1, 0, '')

YAxis(80.0,52.8)

Text(0.5, 1.0, '')

Text(0.0, 1.0, '')

Text(1.0, 1.0, '')

Rectangle(xy=(0, 0), width=1, height=1, angle=0)

AxesSubplot(0.125,0.11;0.775x0.77)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值