|
Re: How do I create a scatter plot with colored symbols in accordance with their frequency of occurrence? [message #88697 is a reply to message #88696] |
Wed, 04 June 2014 15:01   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Madhavan Bomidi writes:
> I know how to make a scatter plot. But I want the symbol colors being represented by the frequency of occurrence. Can anyone help me with an example synthetic data?
x = RandomU(-3L, 200)*5
y = 2.2 + RandomU(-5L, 200)*x
data = RandomU(-2L, 200) * 10
h = cgHistogram(data, binsize=0.5, REVERSE_INDICES=ri)
cgLoadCT, 33, NColors=20
cgPlot, x, y, /NoData, Position=[0.15,0.15, 0.8, 0.9]
FOR j=0,19 DO BEGIN
indices = cgReverseIndices(ri, j, COUNT=count)
IF count GT 0 THEN BEGIN
cgPlotS, x[indices], y[indices], PSYM=16, COLOR=Byte(j)
ENDIF
ENDFOR
cgColorbar, NColors=20, Range=[0,10], Divisions=10, /Vertical, $
Title='Frequency of Occurance', TLocation='Right'
END
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
Re: How do I create a scatter plot with colored symbols in accordance with their frequency of occurrence? [message #88698 is a reply to message #88697] |
Thu, 05 June 2014 08:53  |
atmospheric physics
Messages: 121 Registered: June 2010
|
Senior Member |
|
|
Thank you David ...It works!
On Thursday, June 5, 2014 12:01:00 AM UTC+2, David Fanning wrote:
> Madhavan Bomidi writes:
>
>
>
>> I know how to make a scatter plot. But I want the symbol colors being represented by the frequency of occurrence. Can anyone help me with an example synthetic data?
>
>
>
> x = RandomU(-3L, 200)*5
>
> y = 2.2 + RandomU(-5L, 200)*x
>
> data = RandomU(-2L, 200) * 10
>
>
>
> h = cgHistogram(data, binsize=0.5, REVERSE_INDICES=ri)
>
> cgLoadCT, 33, NColors=20
>
> cgPlot, x, y, /NoData, Position=[0.15,0.15, 0.8, 0.9]
>
> FOR j=0,19 DO BEGIN
>
> indices = cgReverseIndices(ri, j, COUNT=count)
>
> IF count GT 0 THEN BEGIN
>
> cgPlotS, x[indices], y[indices], PSYM=16, COLOR=Byte(j)
>
> ENDIF
>
> ENDFOR
>
> cgColorbar, NColors=20, Range=[0,10], Divisions=10, /Vertical, $
>
> Title='Frequency of Occurance', TLocation='Right'
>
> END
>
>
>
> Cheers,
>
>
>
> David
>
>
>
>
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|