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

Home » Public Forums » archive » Plot scatter points with transparency
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: Plot scatter points with transparency [message #94587 is a reply to message #94580] Mon, 17 July 2017 03:56 Go to previous messageGo to previous message
Markus Schmassmann is currently offline  Markus Schmassmann
Messages: 129
Registered: April 2016
Senior Member
On 07/15/2017 12:00 AM, chengyuxi34@gmail.com wrote:
> Is there a way to do transparent scatter plots?
> (Usually I use cgScatter2D.pro to do scatter plots)
>
> I need to overlay a large number of scatter points in one plot,
> which consist of several groups. I want to assign different groups
> with different colors. The problems is they just tend to block
> each other due to the large number. Is a way to plot them with
> transparency or any other good solution?
One approach is to edit the ps/epd/pdf or whatever file produced to make
the points transparent (don't ask me how...)

Another, randomize the order in which you make the plots, instead of
plotting one group after the other.

With the SCATTERPLOT function you can do it with

n=n_elements(x)
s=sort(randomu(seed,n))
s1=scatterplot(x[s],y[s],symbol='.',magnitude=whichGroup[s], rgb_table=myColors)

with cgScatter2D my guess is

cgScatter2D, x[s], y[s], color=group_colors[whichGroup[s]]

should work too.


Another approach is making a 2d histogram for each group, and then using
the result as index into a color table (maybe with a log in between).
Then you can use some kind of color mixing to calculate the final color.

w1=where(whichGroup eq 1)
h1=hist_2d(x[w1],y[w1],min1=0.,min2=0.,max1=1.,max2=1.,bin1= .1,bin2=.1)
...

That is more complicated than the other approaches, but the result is
likely to be clearer. You might want to increase the resolution of the
2d histogram to match the number of pixels in your output.

I hope one of the approaches described is helpful to you, good luck.

Markus
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Creating executable sav file
Next Topic: Writing to Multiple txt file with different names

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

Current Time: Wed Oct 08 13:56:17 PDT 2025

Total time taken to generate the page: 0.00188 seconds