简体   繁体   中英

How to change the colours of a contour plot

I am using this code below to create a contour plot, and it is okay, very succeed, but I cannot change the colors, do someone knows how to do that?

import numpy as np
import matplotlib.pyplot as plt
import scipy.interpolate
N = 500 #number of points for plotting/interpolation
x, y, z = np.genfromtxt(r'data.txt', unpack=True)
xi = np.linspace(x.min(), x.max(),N)
yi = np.linspace(y.min(), y.max(),N)
zi = scipy.interpolate.griddata((x, y), z, (xi[None,:], yi[:,None]),method='cubic')
fig = plt.figure()
pcolor(xi, yi, zi)
plt.xlabel("x")
plt.ylabel("y")
plt.colorbar()
cmap=matplotlib.colors.Colormap('hot')
plt.show()

This code is creating something like this Output Image
In that scale, but I would like to have something like this Expexted Image :

I mean, I just want to change the colours, the images came from google, I just want s imilar colours...

Thank you

pcolor(xi, yi, zi, cmap=plt.get_cmap('hot'))

这里获取标准颜色图的名称

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM