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 #94589 is a reply to message #94580] Mon, 17 July 2017 18:56 Go to previous message
dg86 is currently offline  dg86
Messages: 118
Registered: September 2012
Senior Member
On Friday, July 14, 2017 at 6:00:31 PM UTC-4, ChengYu Xi 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?
>
> Thanks,
> Chengyu

The plot() function does exactly what you want. Here's a sketch of what you
might want to do:

colors = bytarr(n_elements(x))
p = plot(x, y, linestyle='', symbol='o', $
/sym_filled, transparency=50, rgb_table=34, vert_colors=colors)

Your data points are stored in x and y. The linestyle and symbol options plot the
data as circles that are not connected by lines. The flag /sym_filled fills the circles.
You'll want to choose (or create) a color table. rgb_table=34 is a rainbow table.
The vert_colors is an array of indexes into the color table, one for each point in the
plot. You'll have to figure out what the indexes should be for your data.
Finally, transparency=50 sets each plot symbol to 50% transparency. You'll want
to adjust this number to get the effect you want.

There are lots of other options, and I recommend reading the documentation for
the plot() function.

For what it's worth, the built-in function graphics routines are quite good for making
publication-quality plots.

All the best,

David
[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 17:29:06 PDT 2025

Total time taken to generate the page: 0.00398 seconds