[MATRIX-SIG] making a text label from an object instance?

Konrad Hinsen hinsen@ibs.ibs.fr
Fri, 11 Jul 1997 12:38:22 +0200


> At 11:43 AM 7/10/97 +0200, Konrad Hinsen wrote:
> >I wouldn't worry too much about default labels. I find them rarely
> >useful. It's simple enough to pass an explicit string.
> 
> Don't do a lot of automatically generated plots, eh?

I do, but on the screen. I rarely print plots other than for
seminars or publications.

> Default labels are _very_ useful. I don't see a really easy way
> to do it in python, but it's one of the things people really
> like when it's available.

OK, so here's how to do them in Python:

def plot(x, y):
    label_x = ''
    if type(x) == type(''):
        label_x = x
        x = eval(x)
    label_y = ''
    if type(y) == type(''):
        label_y = y
        y = eval(y)
    do_the_plot(x, label_x, y, label_y)

-- 
-------------------------------------------------------------------------------
Konrad Hinsen                          | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire   | Tel.: +33-4.76.88.99.28
Institut de Biologie Structurale       | Fax:  +33-4.76.88.54.94
41, av. des Martyrs                    | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France         | Nederlands/Francais
-------------------------------------------------------------------------------

_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________