Eric Firing, on 2011-01-25 19:52,  wrote:
> On 01/25/2011 06:58 PM, Shrividya Ravi wrote:
> [...]
> > On the same topic of the colorbar, how can I readjust the colors such
> > that it only goes between user-specified values? For example, I have one
> > imshow plot where the values range between 0 and 350. However, I only
> > want to look at the values between 300 and 350.
> 
> z = np.arange(25)
> z.shape = 5,5
> imshow(z, vmin=10, vmax=20, interpolation='nearest')
> colorbar(extend='both')
> 
> Does that give the desired result?

Hi Shrividya,

Here's how I interpreted what was being asked, in case that
helps. 

Also, Eric, is there a reason we make an outline instead of
just cbar.ax.set_frame_on? - My manual adjustments screw up and
confuse whatever data cbar.outline depends on

x = np.random.rand(100)
y = np.random.rand(100)
z = np.random.rand(100)
collection = plt.scatter(x, y, c=z*350, vmin=0, vmax=350)
cbar = plt.colorbar()
cbar.ax.set_ylim(cbar.norm((300,350)))
cbar.ax.set_xlim(cbar.norm((300,350))) # maintain aspect ratio
cbar.set_ticks(np.linspace(300,350,6))
# didn't see a quick way to fix the outline
cbar.outline.set_visible(False) 
cbar.ax.set_frame_on(True)
plt.draw()

best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to