Matplotlib.artist.artist.properties() - 获取artist的所有属性的字典

夜幕星河

Matplotlib.artist.artist.properties()

Python matplotlib库的artist模块中的properties()方法用于获取artist的所有属性的字典。

语法:Artist.properties(self)

参数:该方法不接受任何参数。

这个方法返回artist的所有属性的字典。

下面的例子说明了matplotlib中的matplotlib.artist.artist.properties()函数:

示例1

# Implementation of matplotlib function
from matplotlib.artist import Artist
import numpy as np  
import matplotlib.pyplot as plt  
        
  
xx = np.random.rand(16, 30)  
        
fig, ax = plt.subplots()  
        
m = ax.pcolor(xx)  
m.set_zorder(-20) 
    
w = Artist.properties(ax) 
print("Display all Properties\n") 
for i in w: 
    print(i, ":", w[i]) 
      
fig.suptitle('matplotlib.artist.Artist.properties() \
function Example', fontweight ="bold") 
  
plt.show()

输出:

Matplotlib.artist.artist.properties() - 获取artist的所有属性的字典

示例2

# Implementation of matplotlib function
from matplotlib.artist import Artist
import matplotlib.pyplot as plt 
import numpy as np 
  
          
np.random.seed(10**7) 
geeks = np.random.randn(100) 
     
fig, ax = plt.subplots() 
ax.acorr(geeks, usevlines = True, 
         normed = True, 
         maxlags = 80, lw = 3) 
    
ax.grid(True) 
    
w = Artist.properties(ax) 
print("Display all Properties\n") 
for i in w: 
    print(i, ":", w[i]) 
      
fig.suptitle('matplotlib.artist.Artist.properties() \
function Example', fontweight ="bold") 
  
plt.show()

输出:

Matplotlib.artist.artist.properties() - 获取artist的所有属性的字典

版权声明:本页面内容旨在传播知识,为用户自行发布,若有侵权等问题请及时与本网联系,我们将第一时间处理。E-mail:284563525@qq.com

目录[+]

取消
微信二维码
微信二维码
支付宝二维码