Custom contour labels?

"Zelakiewicz, Scott (GE, Research)"
<zelakiew@...401...> writes:

I get one contour line as expected, but instead of printing the contour
level (50) I would like to print a simple string like "Some String." I
tried using the fmt option of clabel, but it requires a way to stuff in
the level value (ie. fmt="Some String %f"). Is it possible to use a
simple string for these labels?

I don't know if there is a recommended way, but here is a quick hack:

class FormatFaker(object):
    def __init__(self, str): self.str = str
    def __mod__(self, stuff): return self.str

A=arange(100).reshape(10,10)
CS=contour(A,[50,])
CS.clabel(fmt=FormatFaker('Some String'))
show()

···

--
Jouni K. Sepp�nen
http://www.iki.fi/jks