|
From: Alan G I. <ala...@gm...> - 2010-03-28 22:36:50
|
On 3/28/2010 3:04 PM, Ryan May wrote: > it's just using indices, which run from 0 to 99. Since the limits > are 0 to 100, bam...white space because, indeed, there is no data. > OK, it's obvious one you point it out. Sorry for the typo in the example. Now suppose I want a colorbar labelled at -1, 0, 1 but the highest value realized is <1. Can I somehow use ticks=(-1,0,1) anyway, or do I have to tick at the realized limits and then label "falsely". Here's an example, hopefully without typos this time. x = np.linspace(-5, 5, 101) y = x Z = np.sin(x*y[:,None]).clip(-1,1-1E-6) fig = plt.figure() ax = fig.add_subplot(1,1,1) cax = ax.imshow(Z, interpolation='nearest', extent=[-5,5,-5,5]) cbar = fig.colorbar(cax, ticks=(-1, 0, 1)) As you see, the top tick is not labelled. Thanks, Alan |