Re: different plotting symbols for different points [message #67694] |
Wed, 12 August 2009 09:39 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
maurya writes:
> Is there any routine that can be used to represent every points in 2D
> plot by different symbols?
>
> Actually, I want to plot two array (say, xarr and yarr) of length 80
> using different symbols (or numbers 1, 2,...80) so that I can identify
> every points in 2D. One way is to use xyouts. But it will be more
> useful if the is any routine.
Oddly enough, I was asked this same question twice yesterday,
by different people. Must be a weird convergence of IDL energy
in the Universe. Anyway, it was simple enough, I decided to
write an article about it. You can find it here:
http://www.dfanning.com/graphics_tips/numlabel.html
Cheers,
David
--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: different plotting symbols for different points [message #67698 is a reply to message #67694] |
Wed, 12 August 2009 02:50  |
maurya
Messages: 16 Registered: February 2009
|
Junior Member |
|
|
On 12 Aug, 12:49, David Fanning <n...@dfanning.com> wrote:
> maurya writes:
>> Is there any routine that can be used to represent every points in 2D
>> plot by different symbols?
>
>> Actually, I want to plot two array (say, xarr and yarr) of length 80
>> using different symbols (or numbers 1, 2,...80) so that I can identify
>> every points in 2D. One way is to use xyouts. But it will be more
>> useful if the is any routine.
>
> How about this:
>
> PRO PlotNumbers, x, y
>
> IF N_Elements(y) EQ 0 THEN y = RandomU(-3L, 80) * 100
> npts = N_Elements(y)
> IF N_Elements(x) EQ 0 THEN x = Indgen(npts)
> Plot, x, y, BACKGROUND=FSC_Color('ivory'), COLOR=FSC_Color('navy')
> OPlot, x, y, COLOR=FSC_Color('ivory'), PSYM=SymCat(15), SYMSIZE=2.0
> XYouts, x, y, StrTrim(Sindgen(npts)+1, 2), COLOR=FSC_Color('red'), $
> ALIGN=0.5, CHARSIZE=0.75
>
> END
>
> You can find FSC_Color, SymCat, and other programs you need in
> the Coyote Library.
>
> http://www.dfanning.com/catalysy/howtoinstall.html
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Thanks David!
|
|
|
Re: different plotting symbols for different points [message #67699 is a reply to message #67698] |
Wed, 12 August 2009 00:49  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
maurya writes:
> Is there any routine that can be used to represent every points in 2D
> plot by different symbols?
>
> Actually, I want to plot two array (say, xarr and yarr) of length 80
> using different symbols (or numbers 1, 2,...80) so that I can identify
> every points in 2D. One way is to use xyouts. But it will be more
> useful if the is any routine.
How about this:
PRO PlotNumbers, x, y
IF N_Elements(y) EQ 0 THEN y = RandomU(-3L, 80) * 100
npts = N_Elements(y)
IF N_Elements(x) EQ 0 THEN x = Indgen(npts)
Plot, x, y, BACKGROUND=FSC_Color('ivory'), COLOR=FSC_Color('navy')
OPlot, x, y, COLOR=FSC_Color('ivory'), PSYM=SymCat(15), SYMSIZE=2.0
XYouts, x, y, StrTrim(Sindgen(npts)+1, 2), COLOR=FSC_Color('red'), $
ALIGN=0.5, CHARSIZE=0.75
END
You can find FSC_Color, SymCat, and other programs you need in
the Coyote Library.
http://www.dfanning.com/catalysy/howtoinstall.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|