Adding Text/Equations to Plots [message #65705] |
Mon, 16 March 2009 11:53 |
Heather
Messages: 2 Registered: March 2009
|
Junior Member |
|
|
Hello,
I'm hoping someone can help me figure out a way to add equations to a
plot. I used POLY_FIT to find the coefficients of a line for my data,
and plotted that line. I really want to add the equation of that line
to my plot.
I thought I could use legend.pro (a routine I found at
http://astro.uni-tuebingen.de/software/idl/astrolib/plot/leg end.pro
that I am already calling in my routine anyhow), but that requires the
input "items" be a string. And I couldn't figure out how to create a
string that would call the elements of the array in which the
coefficients are.
(This is what I tried:
IDL> numbers=findgen(10)
IDL> string="This is a number: numbers(6)"
IDL> print, string
This is a number: numbers(6)
Clearly not what I want. And I can't do something like:
IDL> string1="This is a number: "
IDL> print, string1, numbers(6)
This is a number: 6.00000
because what it will actually look like to the legend.pro routine is:
IDL> string2="This is a number: " numbers(6)
string2="This is a number: " numbers(6)
^
% Syntax error.
Any advice would be greatly appreciated, but I'm fairly new to the
world of IDL, so please use "simple" explanations!
Thanks,
Heather
|
|
|