Re: variables in plot titles [message #7798] |
Tue, 14 January 1997 00:00 |
f055
Messages: 29 Registered: April 1995
|
Junior Member |
|
|
In article <32DA4B51.167E@gl.umbc.edu>, allen bobby <ballen1@gl.umbc.edu> writes:
-I wanted to know if it is possible to have the value of a variable in
-the title of a plot? FOr instance, say I want the value of x in the
-title, because it might change with each complilation for some reason.
-How would I do that, if it's possible.
An easy one.
IDL> i=1951
IDL> plot,data,title='A plot of data for year '+string(i,format='(I4)')
The format parameter is optional, you could just use string(i).
Tim
......................... Dr Tim Osborn . t.osborn@uea.ac.uk
.... ___/.. __ /.. /.. /. Senior Research Associate . phone:01603 592089
... /..... /. /.. /.. /.. Climatic Research Unit . fax: 01603 507784
.. /..... __/.. /.. /... School of Environmental Sciences.
. /..... /\ ... /.. /.... University of East Anglia .
____/.._/..\_..____/..... Norwich NR4 7TJ .
......................... UK .
|
|
|
Re: variables in plot titles [message #7800 is a reply to message #7798] |
Mon, 13 January 1997 00:00  |
Andy Loughe
Messages: 174 Registered: November 1995
|
Senior Member |
|
|
David Fanning wrote:
>
> Bobby Allen <ballen1@gl.umbc.edu> writes:
>
>> I wanted to know if it is possible to have the value of a variable in
>> the title of a plot? For instance, say I want the value of x in the
>> title, because it might change with each complilation for some reason.
>> How would I do that, if it's possible.
>
> Try this:
>
> x = 5
> thisTitle = 'Number ' + STRTRIM(x,2)
> PLOT, FINDGEN(10), Title=thisTitle
Or more generally...
thisTitle = 'Number ' + strcompress( string(x) )
--
Andrew F. Loughe | afl@cdc.noaa.gov
University of Colorado, CIRES | http://cdc.noaa.gov/~afl
Campus Box 449 | phn:(303)492-0707 fax:(303)497-7013
Boulder, CO 80309-0449 | "If you are going to be blue, be bright
blue!"
|
|
|
Re: variables in plot titles [message #7805 is a reply to message #7800] |
Mon, 13 January 1997 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Bobby Allen <ballen1@gl.umbc.edu> writes:
> I wanted to know if it is possible to have the value of a variable in
> the title of a plot? For instance, say I want the value of x in the
> title, because it might change with each complilation for some reason.
> How would I do that, if it's possible.
Try this:
x = 5
thisTitle = 'Number ' + STRTRIM(x,2)
PLOT, FINDGEN(10), Title=thisTitle
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
2642 Bradbury Court, Fort Collins, CO 80521
Phone: 970-221-0438 Fax: 970-221-4762
E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
-----------------------------------------------------------
|
|
|