简体   繁体   中英

Z-axis in contour plot not auto scalling

I have a hopefully quick question. I am creating a contour plot but when I do, the Z-axis scaling is pretty odd. I am not sure how to adjust it so I can have more sensitivity. (the range should be around 0.2-2 basically)

Here is my contour plot 在此处输入图像描述

Here is my code for the contour plot:

cmap = matplotlib.colors.LinearSegmentedColormap('my_colormap',cdict,256) #Make a map for colour intensities
plt.xlabel('K1')
plt.ylabel('K2')
plt.contourf(X_C,Y_C,Z_C,50,cmap=cmap) #X values, Y Values, Z Values, Smoothing Factor, colour map
plt.colorbar() #Give a bar showing the intensity corresponding to colour
plt.show() #Show the plot

Thanks a ton everyone!

I created array between 0.2 to 2 for Z-axis. Code is shown below:

import numpy as np
from matplotlib.pylab import plt
import matplotlib.colors

level = np.arange(0.2, 2, 0.035, dtype=float)


cmap = matplotlib.colors.LinearSegmentedColormap('my_colormap',cdict,256) #Make a map for colour intensities
plt.xlabel('K1')
plt.ylabel('K2')
plt.contourf(X_C,Y_C,Z_C,level,cmap=cmap) #X values, Y Values, Z Values, Smoothing Factor, colour map
plt.colorbar() #Give a bar showing the intensity corresponding to colour
plt.show() #Show the plot

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