labeling contours with roman numerals

Michael -

This trick for replacing contour labels
with a string was posted a little while back (by someone else):

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’))

···

From: Michael Hearne <mhearne@…924…

Subject: [Matplotlib-users] labeling contours with roman numerals
To: Matplotlib Users matplotlib-users@lists.sourceforge.net
Message-ID: <
8431E9B8-87E1-4ABD-BE74-940669D97CCB@…924…>
Content-Type: text/plain; charset=“us-ascii”

Does a LineCollection generated by contour() have a property that

holds the labels? I would like to label my contour lines with roman
numerals, and cannot figure out how to get clabel to do that.

Thanks,

Mike

I’ve seen this, but I’m not clever enough to see how to extend that to multiple levels - after all, I don’t want to label every line with the same string…

–Mike

···

On Dec 14, 2007, at 3:20 PM, Mark Bakker wrote:

Michael -

This trick for replacing contour labels with a string was posted a little while back (by someone else):

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’))

From: Michael Hearne <mhearne@…1815… >
Subject: [Matplotlib-users] labeling contours with roman numerals
To: Matplotlib Users matplotlib-users@lists.sourceforge.net
Message-ID: < 8431E9B8-87E1-4ABD-BE74-940669D97CCB@…924…>
Content-Type: text/plain; charset=“us-ascii”

Does a LineCollection generated by contour() have a property that
holds the labels? I would like to label my contour lines with roman
numerals, and cannot figure out how to get clabel to do that.

Thanks,

Mike


Michael Hearne

mhearne@…924…

(303) 273-8620

USGS National Earthquake Information Center

1711 Illinois St. Golden CO 80401

Senior Software Engineer

Synergetics, Inc.


I would guess:

CS=contour(A,[50,])
CS.clabel(fmt=FormatFaker(‘I’)) # Labels contour 50 with I
CS=contour(A,[60,])
CS.clabel(fmt=FormatFaker(‘II’)) # Labels contour 60 with II

Or write a loop if you have many values.

Mark

···

On Dec 14, 2007 11:44 PM, Michael Hearne < mhearne@…924…> wrote:

I’ve seen this, but I’m not clever enough to see how to extend that to multiple levels - after all, I don’t want to label every line with the same string…

–Mike
On Dec 14, 2007, at 3:20 PM, Mark Bakker wrote:

Michael -

This trick for replacing contour labels with a string was posted a little while back (by someone else):

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’))

From: Michael Hearne <mhearne@…924… >
Subject: [Matplotlib-users] labeling contours with roman numerals
To: Matplotlib Users <
matplotlib-users@lists.sourceforge.net>
Message-ID: < 8431E9B8-87E1-4ABD-BE74-940669D97CCB@…924…>
Content-Type: text/plain; charset=“us-ascii”

Does a LineCollection generated by contour() have a property that
holds the labels? I would like to label my contour lines with roman
numerals, and cannot figure out how to get clabel to do that.

Thanks,

Mike


Michael Hearne

mhearne@…924…

(303) 273-8620

USGS National Earthquake Information Center

1711 Illinois St. Golden CO 80401

Senior Software Engineer

Synergetics, Inc.