bug in labeling contour lines

Hello list -

There seems to be a bug in labeling contour lines.
When I call clabel, it removes all contours that are not labeled (because the label doesn’t fit on the section of contour, I presume).

This seems like a bug to me (or a really odd feature).

Easy example:

x,y = meshgrid( linspace(-10,10,50), linspace(-10,10,50) )
z = log(x2 + y2)
cobj = contour(x,y,z)

cobj.clabel()
<a list of 8 text.Text objects>

draw()

And now all contours without a label are gone. On my machine it draws labels on contours from 1 through 5, and erases the contours in the middle of the plot with values -2, -1, and 0.

Mark

A little follow-up.
When I use keyword argument inline=False, it doesn’t remove the lines without a label.

So it seems that when using inline=True the unlabeled contours get a white box, but no label (because it doesn’t fit) which essentially removes the entire contour.

Mark

···

On Wed, Aug 6, 2008 at 2:27 PM, Mark Bakker <markbak@…287…> wrote:

Hello list -

There seems to be a bug in labeling contour lines.
When I call clabel, it removes all contours that are not labeled (because the label doesn’t fit on the section of contour, I presume).

This seems like a bug to me (or a really odd feature).

Easy example:

x,y = meshgrid( linspace(-10,10,50), linspace(-10,10,50) )
z = log(x2 + y2)
cobj = contour(x,y,z)

cobj.clabel()
<a list of 8 text.Text objects>

draw()

And now all contours without a label are gone. On my machine it draws labels on contours from 1 through 5, and erases the contours in the middle of the plot with values -2, -1, and 0.

Mark