Python draws three-dimensional surface maps of multiple color combinations

import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
from mpl_toolkits.mplot3d import Axes3D

plt.style.use('seaborn-darkgrid')

# Make data
X = np.arange(-5, 5, 0.25)
Y = np.arange(-5, 5, 0.25)
X, Y = np.meshgrid(X, Y)
R = np.sqrt(X**2 + Y**2)
Z = np.sin(R)

# Plot the surface
fig, ax = plt.subplots(subplot_kw={
    
    "projection": "3d"})
ax.plot_surface(X, Y, Z, vmin=Z.min() * 2, cmap=cm.Blues)

ax.set(xticklabels=[],
       yticklabels=[],
       zticklabels=[])

plt.show()

insert image description here

ax.plot_surface(X, Y, Z, vmin=Z.min() * 2, cmap=cm.Paired)

insert image description here

ax.plot_surface(X, Y, Z, vmin=Z.min() * 2, cmap=cm.Accent)

insert image description here

ax.plot_surface(X, Y, Z, vmin=Z.min() * 2, cmap=cm.Accent_r)

insert image description here

ax.plot_surface(X, Y, Z, vmin=Z.min() * 2, cmap=cm.BrBG)

insert image description here

ax.plot_surface(X, Y, Z, vmin=Z.min() * 2, cmap=cm.BrBG_r)

insert image description here

ax.plot_surface(X, Y, Z, vmin=Z.min() * 2, cmap=cm.BuGn)

insert image description here

ax.plot_surface(X, Y, Z, vmin=Z.min() * 2, cmap=cm.BuPu)

insert image description here

ax.plot_surface(X, Y, Z, vmin=Z.min() * 2, cmap=cm.BuPu_r)

insert image description here

ax.plot_surface(X, Y, Z, vmin=Z.min() * 2, cmap=cm.CMRmap)

insert image description here
Due to the limited energy of the author, there are so many color combinations for you to choose from: Accent, Accent_r, Blues, Blues_r, BrBG, BrBG_r, BuGn, BuGn_r, BuPu, BuPu_r, CMRmap, CMRmap_r, Dark2, Dark2_r, GnBu, GnBu_r, Greens , Greens_r, Greys, Greys_r, OrRd, OrRd_r, Oranges, Oranges_r, PRGn, PRGn_r, Paired, Paired_r, Pastel1, Pastel1_r, Pastel2, Pastel2_r, PiYG, PiYG_r, PuBu, PuBuGn, PuBuGn_r, PuBu_ r, PuOr, PuOr_r, PuRd, PuRd_r , Purples, Purples_r, RdBu, RdBu_r, RdGy, RdGy_r, RdPu, RdPu_r, RdYlBu, RdYlBu_r, RdYlGn, RdYlGn_r, Reds, Reds_r, Set1, Set1_r, Set2, Set2_r, Set3, Set3_r, Spectral, Spectral ral_r, Wistia, Wistia_r, YlGn , YlGnBu, YlGnBu_r, YlGn_r, YlOrBr, YlOrBr_r, YlOrRd, YlOrRd_r, afmhot, afmhot_r, autumn, autumn_r, binary, binary_r, bone, bone_r, brg, brg_r, bwr, bwr_r, cividis, cividis_r , cool, cool_r, coolwarm, coolwarm_r , copper, copper_r, cubehelix, cubehelix_r, flag, flag_r, gist_earth, gist_earth_r,gist_gray, gist_gray_r, gist_heat, gist_heat_r, gist_ncar, gist_ncar_r, gist_rainbow, gist_rainbow_r, gist_stern, gist_stern_r, gist_yarg, gist_yarg_r, gnuplot, gnuplot2, gnuplot2_r, gnuplot_r, gray, gray_r, hot, hot_r, hsv, hsv_r, inferno, inferno_r, jet, jet_r, magma, magma_r, nipy_spectral, nipy_spectral_r, ocean, ocean_r, pink, pink_r, plasma, plasma_r, prism, prism_r, rainbow, rainbow_r, seismic, seismic_r, spring, spring_r, summer, summer_r, tab10, tab10_r, tab20, tab20_r, tab20b, tab20b_r, tab20c, tab20c_r, terrain, terrain_r, twilight, twilight_r, twilight_shifted, twilight_shifted_r, viridis, viridis_r, winter, winter_rhsv_r, inferno, inferno_r, jet, jet_r, magma, magma_r, nipy_spectral, nipy_spectral_r, ocean, ocean_r, pink, pink_r, plasma, plasma_r, prism, prism_r, rainbow, rainbow_r, seismic, seismic_r, spring, spring_r, summer, summer_r, tab10, tab10_r, tab20, tab20_r, tab20b, tab20b_r, tab20c, tab20c_r, terrain, terrain_r, twilight, twilight_r, twilight_shifted, twilight_shifted_r, viridis, viridis_r, winter, winter_rhsv_r, inferno, inferno_r, jet, jet_r, magma, magma_r, nipy_spectral, nipy_spectral_r, ocean, ocean_r, pink, pink_r, plasma, plasma_r, prism, prism_r, rainbow, rainbow_r, seismic, seismic_r, spring, spring_r, summer, summer_r, tab10, tab10_r, tab20, tab20_r, tab20b, tab20b_r, tab20c, tab20c_r, terrain, terrain_r, twilight, twilight_r, twilight_shifted, twilight_shifted_r, viridis, viridis_r, winter, winter_r
References: https://matplotlib.org/stable/plot_types/3D/surface3d_simple.html
Development tools: PyCharm

Guess you like

Origin blog.csdn.net/m0_38127487/article/details/132186321