📌  相关文章
📜  Python中的 Matplotlib.axis.Tick.properties()函数

📅  最后修改于: 2022-05-13 01:55:49.609000             🧑  作者: Mango

Python中的 Matplotlib.axis.Tick.properties()函数

Matplotlib是Python中的一个库,它是 NumPy 库的数值数学扩展。它是Python中用于二维数组图的惊人可视化库,用于处理更广泛的 SciPy 堆栈。

Matplotlib.axis.Tick.properties()函数

matplotlib 库的轴模块中的Tick.properties()函数用于获取艺术家所有属性的字典。

下面的示例说明了 matplotlib.axis 中的 matplotlib.axis.Tick.properties()函数:
示例 1:

Python3
# Implementation of matplotlib function
from matplotlib.axis import Tick
import numpy as np   
import matplotlib.pyplot as plt   
           
     
xx = np.random.rand(3, 4)   
           
fig, ax = plt.subplots()   
           
m = ax.pcolor(xx)   
m.set_zorder(2)  
       
w = Tick.properties(ax)  
print("Display first 10 Properties\n")  
for i in list(w)[:10]:  
    print(i, ":", w[i]) 
  
fig.suptitle('matplotlib.axis.Tick.properties() \
function Example', fontweight ="bold")  
     
plt.show()


Python3
# Implementation of matplotlib function
from matplotlib.axis import Tick
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 = 25, lw = 3)  
       
ax.grid(True)  
       
w = Tick.properties(ax)  
print("Display last 10 Properties\n")  
for i in list(w)[-10:]:  
    print(i, ":", w[i]) 
  
fig.suptitle('matplotlib.axis.Tick.properties() \
function Example', fontweight ="bold")  
     
plt.show()


输出:

Display first 10 Properties

adjustable : box
agg_filter : None
alpha : None
anchor : C
animated : False
aspect : auto
autoscale_on : True
autoscalex_on : True
autoscaley_on : True
axes_locator : None

示例 2:

Python3

# Implementation of matplotlib function
from matplotlib.axis import Tick
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 = 25, lw = 3)  
       
ax.grid(True)  
       
w = Tick.properties(ax)  
print("Display last 10 Properties\n")  
for i in list(w)[-10:]:  
    print(i, ":", w[i]) 
  
fig.suptitle('matplotlib.axis.Tick.properties() \
function Example', fontweight ="bold")  
     
plt.show() 

输出:

Display last 10 Properties

ygridlines : 
ylabel : 
ylim : (-0.300605326634452, 1.061933586982593)
ymajorticklabels : 
yminorticklabels : 
yscale : linear
yticklabels : 
yticklines : 
yticks : [-0.4 -0.2  0.   0.2  0.4  0.6  0.8  1.   1.2]
zorder : 0