|
From: Jae-Joon L. <lee...@gm...> - 2010-01-20 18:20:49
|
On Wed, Jan 20, 2010 at 12:12 PM, Mario Mech <me...@me...> wrote:
> the smallest value (0.0) is labeled with "-0.0". I just want to get rid of the minus sign.
>
This is because the actual value is "-9.00000000e-06" (this inherits
from the levels of contour).
While I think we're fixing a wrong problem (the contour routine need
to be fixed in my view), here is a workaround you may use.
-JJ
import numpy as np
from matplotlib import pyplot,mpl
x = np.arange(10)
y = np.arange(25)
z = np.floor(10*np.random.random((25,10)))
cntr = pyplot.contourf(x,y,z)
cb = pyplot.colorbar(format=r"%2.1f")
ticklabel_seq = cb.ax.yaxis.major.formatter.seq
try:
indx = ticklabel_seq.index("-0.0")
ticklabel_seq[indx]="0.0"
except ValueError:
pass
pyplot.show()
|