Python Which colormap scheme should be used for exponential data?

Problem

I have a plot that I am trying to make for precipitation rate trends around the world using grid data. I can make the plot very good, but the range of colors gives me problems. I cannot figure out how to make colormap more suitable for my data, which seems exponential. I tried the logarithmic range, but it does not quite match the data.

Code and data range

Here my 8192 data values ​​look when they are plotted in order on a simple graph of the xy line. Data points are on the x axis, and values ​​are on the y axis. enter image description here

Here, my data looks like plotted using the LogNormal color range. This is too much peppermint green and orange red for me.

#Set labels lonlabels = ['0','45E','90E','135E','180','135W','90W','45W','0'] latlabels = ['90S','60S','30S','Eq.','30N','60N','90N'] #Set cmap properties norm = colors.LogNorm() #creates logarithmic scale #Create basemap fig,ax = plt.subplots(figsize=(15.,10.)) m = Basemap(projection='cyl',llcrnrlat=-90,urcrnrlat=90,llcrnrlon=0,urcrnrlon=360.,lon_0=180.,resolution='c') m.drawcoastlines(linewidth=1) m.drawcountries(linewidth=1) m.drawparallels(np.arange(-90,90,30.),linewidth=0.3) m.drawmeridians(np.arange(-180.,180.,45.),linewidth=0.3) meshlon,meshlat = np.meshgrid(lon,lat) x,y = m(meshlon,meshlat) #Plot variables trend = m.pcolormesh(x,y,lintrends[:,:,0],cmap='jet', norm=norm, shading='gouraud') #Set plot properties #Colorbar cbar=m.colorbar(trend, size='8%',location='bottom',pad=0.8) #Set colorbar cbar.set_label(label='Linear Trend (mm/day/decade)',size=25) #Set label for t in cbar.ax.get_xticklabels(): t.set_fontsize(25) #Set tick label sizes #Titles & labels fig.suptitle('Linear Trends of Precipitation (CanESM2)',fontsize=40,x=0.51,y=0.965) ax.set_title('a) 1979-2014 Minimum Trend',fontsize=35) ax.set_xticks(np.arange(0,405,45)) ax.set_xticklabels(lonlabels,fontsize=20) ax.set_ylabel('Latitude',fontsize=25) ax.set_yticks(np.arange(-90,120,30)) ax.set_yticklabels(latlabels,fontsize=20) 

enter image description here

And here is what it looks like, with an unchanged default color range. (The same code minus the norm = norm argument.)

enter image description here

Question

Is there a math scheme I can use to create a color map that better shows the range of my data? Or do I need to make my own range?

+5
source share
1 answer

Breaking into

You can try to apply the maximum value, i.e. for any value above 2 just replace it with 2.

Then you will have one color (maximum) representing 2+, and the remaining colors will be distributed more evenly across your data.

0
source

All Articles