Home > other >  Matplotlib painting the color of the 3 d graph, a great god for help
Matplotlib painting the color of the 3 d graph, a great god for help

Time:12-03

 
The import numpy as np
The import pandas as pd
The import matplotlib. Pyplot as PLT
The from mpl_toolkits import mplot3d
The import scipy. Interpolate the as IP
The import matplotlib. Mlab as ml
The from matplotlib. Colors import LightSource
The from matplotlib import cm

Path="E:/Model_building/A/"
S1=pd. Read_excel (path + "sheet1. XLSX")

X=np. Array (s1. Iloc [:, 2])
Y=np. Array (s1) iloc [:, 3])
Z=np. Array (s1. Iloc [:, 4])
Xx=np. Linspace (x.m in (), x.m ax ())
Yy=np. Linspace (y.m in (), y.m ax ())
X, Y=np. Meshgrid (xx, yy)

Z=IP. Griddata ((x, y), Z (x, y), the method='cubic')
Contr=PLT. Contour (X, Y, Z, 30) # contour map

PLT. Figure ()
Ax=PLT. Axes (the projection='3 d') # 3 d topographic map
Ax. Invert_xaxis ()
Ax. Plot_surface (X, Y, Z, rstride=1, cstride=1, cmap="viridis")
PLT. The show ()


Could you tell me why topographic map, or a color from top to bottom,,, for advice

CodePudding user response:

The
refer to the original poster DongDu_rabbit response:
 
The import numpy as np
The import pandas as pd
The import matplotlib. Pyplot as PLT
The from mpl_toolkits import mplot3d
The import scipy. Interpolate the as IP
The import matplotlib. Mlab as ml
The from matplotlib. Colors import LightSource
The from matplotlib import cm

Path="E:/Model_building/A/"
S1=pd. Read_excel (path + "sheet1. XLSX")

X=np. Array (s1. Iloc [:, 2])
Y=np. Array (s1) iloc [:, 3])
Z=np. Array (s1. Iloc [:, 4])
Xx=np. Linspace (x.m in (), x.m ax ())
Yy=np. Linspace (y.m in (), y.m ax ())
X, Y=np. Meshgrid (xx, yy)

Z=IP. Griddata ((x, y), Z (x, y), the method='cubic')
Contr=PLT. Contour (X, Y, Z, 30) # contour map

PLT. Figure ()
Ax=PLT. Axes (the projection='3 d') # 3 d topographic map
Ax. Invert_xaxis ()
Ax. Plot_surface (X, Y, Z, rstride=1, cstride=1, cmap="viridis")
PLT. The show ()


Excuse me why topographic map, or a color, from top to bottom, and consult

What did you do topographic map and 3 d, haven't map...

CodePudding user response:

Is the building Lord this problem solved, please ~
  • Related