Hello,
I have the problem, that sometimes the first and last ticklabel of a
colorbar is not drawn. E.g. if I create a colorbar through
fig.colorbar(p3,orientation='horizontal',ticks=np.arange(0.0,8,2))
I only get ticklabels at 2,4,6, but I would like it to have 0,2,4,6,8 and I
don't know how to
I should perhaps mention, that if i try
cbar=fig.colorbar(p1,orientation='horizontal',ticks=[0.0,2.0,4.0,6.0,8.0])
cbar.ax.set_xticklabels(['0', '2', '4','6','8'])
the colorbar is drawn correctly, but I get the label 0 at position 2, the
label 2 at position 4 and 4 at pos. 6, the labels at the
marcusantonius wrote:
Hello,
I have the problem, that sometimes the first and last ticklabel of a
colorbar is not drawn. E.g. if I create a colorbar through
fig.colorbar(p3,orientation='horizontal',ticks=np.arange(0.0,8,2))
I only get ticklabels at 2,4,6, but I would like it to have
marcusantonius wrote:
I should perhaps mention, that if i try
cbar=fig.colorbar(p1,orientation='horizontal',ticks=[0.0,2.0,4.0,6.0,8.0])
The ticks that it uses are taken from the list--they are the ones that
are within the range of numbers mapped to colors. The list of ticks
does not set
Thank you very much for your email.
Your example
imshow(rand(10,10)*8, vmin=0, vmax=8)
colorbar(ticks=[0,2,4,6,8])
works fine.
Note also that to get the sequence [0,2,4,6,8] you need arange(0,9,2),
not arange(0,8,2). Or you can use linspace(0,8,5) if you prefer.
Thank you for making me aware