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

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

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

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

Matplotlib.axis.Tick.is_transform_set()函数

matplotlib库的axis模块中的Tick.is_transform_set()函数用于获取Artist是否有明确设置的变换。

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

Python3
# Implementation of matplotlib function
from matplotlib.axis import Tick
import matplotlib.pyplot as plt  
import numpy as np  
         
# create test data  
np.random.seed(10**7)  
data = [sorted(np.random.normal(0, std, 100))   
       for std in range(1, 4)]  
         
fig, ax1 = plt.subplots()  
val = ax1.violinplot(data) 
     
ax1.set_title("Is artist is explicitly set transform : "
              +str(Tick.is_transform_set(ax1)))  
  
fig.suptitle('matplotlib.axis.Tick.is_transform_set() \
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  
from matplotlib.patches import Ellipse  
        
      
delta = 15.0
        
angles = np.arange(0, 360 + delta, delta)  
ells = [Ellipse((2, 2), 5, 2, a) for a in angles]  
        
fig, ax = plt.subplots()  
        
for e in ells:  
    Tick.set_clip_box(e, ax.bbox)
    e.set_facecolor("green")
    e.set_alpha(0.05)  
    ax.add_artist(e)  
        
plt.xlim(-1, 5)  
plt.ylim(-1, 5) 
   
ax.set_title("Is artist is explicitly set transform : "
              +str(Tick.is_transform_set(ax)))  
  
fig.suptitle('matplotlib.axis.Tick.is_transform_set() \
function Example', fontweight ="bold")  
     
plt.show()


输出:

示例 2:

Python3

# Implementation of matplotlib function
from matplotlib.axis import Tick
import matplotlib.pyplot as plt  
import numpy as np  
from matplotlib.patches import Ellipse  
        
      
delta = 15.0
        
angles = np.arange(0, 360 + delta, delta)  
ells = [Ellipse((2, 2), 5, 2, a) for a in angles]  
        
fig, ax = plt.subplots()  
        
for e in ells:  
    Tick.set_clip_box(e, ax.bbox)
    e.set_facecolor("green")
    e.set_alpha(0.05)  
    ax.add_artist(e)  
        
plt.xlim(-1, 5)  
plt.ylim(-1, 5) 
   
ax.set_title("Is artist is explicitly set transform : "
              +str(Tick.is_transform_set(ax)))  
  
fig.suptitle('matplotlib.axis.Tick.is_transform_set() \
function Example', fontweight ="bold")  
     
plt.show() 

输出: