logarithmic scale of colorbar with ticks and custom labels

Hello

I have a contour plot with specified number of levels (isolines):

lev = array([2,3,5,7,10,13,17,21,26,32,42,62,80,100,120,140,180])

to have a log "z" axis I put:

from matplotlib import colors
contourf(x1, y1, z1, lev, norm=colors.LogNorm(lev[0],lev[len(lev)-1]))

now, to get colorbar in log scale:

from matplotlib.ticker import LogLocator, LogFormatter
l_f = LogFormatter(10, labelOnlyBase=False)
cbar = colorbar(format = l_f)

But the colorbar doesn't have all tick's labels specified in "lev"
variable. Ticks are placed correctly on the cbar, but only every
second tick has a text label (yes 2, 5, 10 ... etc). What should I do
to have ALL levels on colorbar labeled?

Hello

I have a contour plot with specified number of levels (isolines):

lev = array([2,3,5,7,10,13,17,21,26,32,42,62,80,100,120,140,180])

to have a log "z" axis I put:

from matplotlib import colors
contourf(x1, y1, z1, lev, norm=colors.LogNorm(lev[0],lev[len(lev)-1]))

now, to get colorbar in log scale:

from matplotlib.ticker import LogLocator, LogFormatter
l_f = LogFormatter(10, labelOnlyBase=False)
cbar = colorbar(format = l_f)

But the colorbar doesn't have all tick's labels specified in "lev"
variable. Ticks are placed correctly on the cbar, but only every
second tick has a text label (yes 2, 5, 10 ... etc). What should I do
to have ALL levels on colorbar labeled?

http://matplotlib.sourceforge.net/api/figure_api.html?highlight=colorbar#matplotlib.figure.Figure.colorbar

cbar = colorbar(ticks=lev, format = l_f)

-JJ

···

On Wed, May 6, 2009 at 3:28 PM, Sebastian Pająk <spconv+m@...287...> wrote:

Hello

I have a contour plot with specified number of levels (isolines):

lev = array([2,3,5,7,10,13,17,21,26,32,42,62,80,100,120,140,180])

to have a log "z" axis I put:

from matplotlib import colors
contourf(x1, y1, z1, lev, norm=colors.LogNorm(lev[0],lev[len(lev)-1]))

now, to get colorbar in log scale:

from matplotlib.ticker import LogLocator, LogFormatter
l_f = LogFormatter(10, labelOnlyBase=False)
cbar = colorbar(format = l_f)

But the colorbar doesn't have all tick's labels specified in "lev"
variable. Ticks are placed correctly on the cbar, but only every
second tick has a text label (yes 2, 5, 10 ... etc). What should I do
to have ALL levels on colorbar labeled?

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

OK works. I didn't notice the ticks arg. Thanks again

Sebastian

2009/5/7 Jae-Joon Lee <lee.j.joon@...287...>:

···

http://matplotlib.sourceforge.net/api/figure_api.html?highlight=colorbar#matplotlib.figure.Figure.colorbar

cbar = colorbar(ticks=lev, format = l_f)

-JJ

On Wed, May 6, 2009 at 3:28 PM, Sebastian Pająk <spconv+m@...287...> wrote:

Hello

I have a contour plot with specified number of levels (isolines):

lev = array([2,3,5,7,10,13,17,21,26,32,42,62,80,100,120,140,180])

to have a log "z" axis I put:

from matplotlib import colors
contourf(x1, y1, z1, lev, norm=colors.LogNorm(lev[0],lev[len(lev)-1]))

now, to get colorbar in log scale:

from matplotlib.ticker import LogLocator, LogFormatter
l_f = LogFormatter(10, labelOnlyBase=False)
cbar = colorbar(format = l_f)

But the colorbar doesn't have all tick's labels specified in "lev"
variable. Ticks are placed correctly on the cbar, but only every
second tick has a text label (yes 2, 5, 10 ... etc). What should I do
to have ALL levels on colorbar labeled?

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options