comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » scatter plot , intensity colors. Help
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: scatter plot , intensity colors. Help [message #86534 is a reply to message #86511] Sun, 17 November 2013 02:59 Go to previous messageGo to previous message
limiqt is currently offline  limiqt
Messages: 27
Registered: October 2013
Junior Member
My final code:

Pro sctrpInt

X=[2, 4, 5, 6, 7, 8]
Y=[20, 40, 45, 30, 10, 5]
I=[100,200,300,400,500,600]
nelm=n_elements(X)
colors = cgScaleVector(Findgen(N_Elements(I)), Min(I), Max(I))
clr = Value_Locate(colors, I)
clr = Byte(Round(cgScaleVector(clr, 0, 255)))

cgLoadCT, 33
cgWindow
;the scatterplot
cgPlot, X, Y, /Nodata, /AddCMD
FOR j=0,nelms-1 DO cgPlotS, X[j], Y[j],Color=clr[j], Psym=16,symsize=2,/AddCMD
cgColorbar, Divisions=5, Format='(I3)', Range=[100,600], /AddCMD , Title='I'

End


On Friday, November 15, 2013 8:06:17 AM UTC-5, Lim wrote:
> Dear all,
>
>
>
> I need to do a scatterplot with colored symbols representing the intensity. I am adapting an example I found at http://www.idlcoyote.com/gallery/colored_line_plot.pro I am doing the following:
>
>
>
> X=[2, 4, 5, 6, 7, 8]
>
> Y=[20, 40, 45, 30, 10, 5]
>
> I=[100,200,300,400,500,600]
>
>
>
> ;intensity color
>
> colors = cgScaleVector(Findgen(N_Elements(I)), Min(I), Max(I))
>
> clr = Value_Locate(colors, I)
>
> clr = Byte(Round(cgScaleVector(clr, 0, 255)))
>
>
>
> cgLoadCT, 33
>
> cgWindow
>
>
>
> ;the scatterplot
>
> cgPlot, X, Y, /Nodata, /AddCMD
>
> FOR j=0,N_Elements(X)-2 DO cgPlotS, [X[j], X[j+1]], [Y[j], Y[j+1]], $
>
> Color=clr[j], Psym=16,symsize=2,/AddCMD
>
> FOR j=0,N_Elements(pNPP)-1,2 DO cgPlotS, X[j], Y[j], $
>
> Color=clr[j], Psym=16,symsize=2, /AddCMD
>
>
>
>
>
> However the output produces a gray scale image.
>
> 1. What am I doing wrong?
>
> 2. How can I add a color bar associated with the intensity (I)?
>
>
>
> I will appreciate any assistance.
>
>
>
> Cheers,
>
>
>
> Lim
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: =?UTF-8?Q?How=20to=20use=20IDL=20to=20?==?UTF-8?Q?call=20?= =?UTF-8?Q?SQL=5FServer=5F2008=20datab?==?UTF-8?Q?ase?=
Next Topic: reading in from multiple files, performing operations and printing them to multiple output file

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:48:25 PDT 2025

Total time taken to generate the page: 0.00230 seconds