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

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

Python中的 Matplotlib.axis.Axis.draw()函数

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

Matplotlib.axis.Axis.draw()函数

matplotlib库的axis模块中的Axis.draw()函数用于绘制轴线、网格线、刻度线和标签。

下面的示例说明了 matplotlib.axis 中的 matplotlib.axis.Axis.draw()函数:

示例 1:

Python3
# Implementation of matplotlib function
from matplotlib.axis import Axis
from mpl_toolkits.mplot3d import axes3d   
import matplotlib.pyplot as plt   
         
fig, ax = plt.subplots()   
         
def tellme(s):     
    fig.canvas.draw()  
    renderer = fig.canvas.renderer 
    Axis.draw(ax, renderer)
  
ax.grid() 
  
fig.suptitle("""matplotlib.axis.Axis.draw()
function Example\n""", fontweight ="bold")  
    
plt.show()


Python3
# Implementation of matplotlib function
from matplotlib.axis import Axis
from mpl_toolkits.mplot3d import axes3d   
import matplotlib.pyplot as plt   
         
      
fig = plt.figure()   
ax = fig.add_subplot(111, projection ='3d')   
         
X, Y, Z = axes3d.get_test_data(0.1)   
ax.plot_wireframe(X, Y, Z, rstride = 5,    
                  cstride = 5)   
         
   
ax.view_init(30, 60)  
fig.canvas.draw()  
renderer = fig.canvas.renderer  
ax.draw(renderer)   
  
ax.grid() 
  
fig.suptitle("""matplotlib.axis.Axis.draw()
function Example\n""", fontweight ="bold")  
    
plt.show()


输出:

示例 2:

Python3

# Implementation of matplotlib function
from matplotlib.axis import Axis
from mpl_toolkits.mplot3d import axes3d   
import matplotlib.pyplot as plt   
         
      
fig = plt.figure()   
ax = fig.add_subplot(111, projection ='3d')   
         
X, Y, Z = axes3d.get_test_data(0.1)   
ax.plot_wireframe(X, Y, Z, rstride = 5,    
                  cstride = 5)   
         
   
ax.view_init(30, 60)  
fig.canvas.draw()  
renderer = fig.canvas.renderer  
ax.draw(renderer)   
  
ax.grid() 
  
fig.suptitle("""matplotlib.axis.Axis.draw()
function Example\n""", fontweight ="bold")  
    
plt.show()

输出: