Problem 1: I have a dataset which has more values on one side of the scale
than the other in a contour map. Matplotlib will see that I have more values
towards one side of the scale, and put all of the colors in that color map
to that side of the scale.

For example, lets say I would like my colorbar to show values from -10^6 all
the way to 10^6.
But, most of my values are in the -10^6 to -10^5 range. How do I get my
colorbar not to automatically send all of the colors to that portion of the
colorbar and leave everything greater than -10^5 to have one color.

I would like to have the colorbar displaying the same color scaling
regardless of the data input.

Here is a copy of my code:
v2 =
[-1000000,-100000,-10000,-1000,-100,-10,0,10,100,1000,10000,100000,1000000]
        plt.subplot(6,1,2)
        cset4 = plt.contourf(x2,z2,k2,v2,cmap=cm.get_cmap('jet', len(v2)-1))
        cset5 = plt.contour(x2,z2,k2,v2,colors = 'k',linewidths = .22,hold='on')
        #set axes values
        plt.axis([xmin2,xmax2, zmin,zmax])
        #set y axes label
        plt.ylabel('Z, [km]')
        #display title
        plt.title('v3 Plot              Max:'+str("%.2f" %k2.max())+'           
   Min:
'+str("%.2f" %k2.min()),size='small')
        #colorbar manipulation
        cbar = plt.colorbar(cset4,spacing="uniform", shrink =
0.95,ticks=[-1000000,-100000,-10000,-1000,-100,-10,0,10,100,1000,10000,100000,1000000])

cbar.ax.set_yticklabels(['-10^5','-10^4','-10^3','-10^2','-10^1',0,'10^1','10^2','10^3','10^4','10^5'])
        #close file
        f2.close()

Problem 2: If I have a colorbar scale which goes from -10 to 5, and I use
one of the standard colormaps which has white in the center of it. How do I
keep the zero point at the white color instead of the colorbar automatically
picking the midpoint for zero?

Problem 1 is much more of a pressing issue right now than problem 2.

Thank you 

-- 
View this message in context: 
http://old.nabble.com/Disable-Colorbar-Scaling-In-Contour-Plot-tp29409978p29409978.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to