Re: how to add mark for every points in each plot? [message #10600] |
Wed, 07 January 1998 00:00 |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
David Fanning wrote:
>
> hwang (hwang@umassd.edu) writes:
>
>> I have two arrays.Every array has 12 numbers.Each number stands for the
>> data for every month of some year.My boss want to plot these two
>> arrays(X versus Y) but he let me mark '1','2',......or
>> 'Jan','Feb'......besides every point in the plot.
[...]
[and David provides an example code using xyouts]
just a short addendum: if you want to label the points with numerical
values, you should use the string function (which includes a format
option). Then you would build a label string array like
valstr = string(y,format="(f7.2)")
and put that out as David suggested
xyouts,x,y,valstr,align=0.5
Martin.
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Earth&Planetary Sciences, Harvard University
186 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
phone: (617)-496-8318
fax : (617)-495-4551
e-mail: mgs@io.harvard.edu
IDL-homepage: http://www-as.harvard.edu/people/staff/mgs/idl/
------------------------------------------------------------ -------
|
|
|
Re: how to add mark for every points in each plot? [message #10609 is a reply to message #10600] |
Tue, 06 January 1998 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
hwang (hwang@umassd.edu) writes:
> I have two arrays.Every array has 12 numbers.Each number stands for the
> data for every month of some year.My boss want to plot these two
> arrays(X versus Y) but he let me mark '1','2',......or
> 'Jan','Feb'......besides every point in the plot. I try to find some
> parameters in the PLOT routine which can add such mark,but PLOT has no
> such parameter or function.I try to use OPLOT, in order to every time I
> call OPLOT,it only plot one point.But OPLOT or PLOT only accept the
> array arguments.How can I do? Is there any expert knowing how to do
> this?
Ahem, well, shucks. How about this?
seed = -2L
x = RandomU(seed, 12) * 95 + 2.5
y = RandomU(seed, 12) * 95 + 2.5
Plot, x, y, PSym=2, SymSize=2
months = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', $
'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC']
XYOutS, x, y + 4, months, Alignment=0.5
Cheers,
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|