Re: Using VERT_COLORS=RGBA in PLOT()? [message #88570 is a reply to message #88569] |
Tue, 13 May 2014 10:52   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
On Tuesday, May 13, 2014 10:27:55 AM UTC-6, David Grier wrote:
> Dear Folks,
>
>
>
> I am trying to create a scatter plot in IDL 8.3 (MacOS)
>
> whose symbols have different colors and alpha values.
>
> The documentation for plot() suggests that I should be able to pass a 4 x NPTS array of
>
> RGBA values to the VERT_COLORS property of plot(), where NPTS is the number of points in
>
> my data set. When I try this, IDL complains:
>
>
>
> % PLOT: Array subscript for PALETTE must have same size as source expression.
>
>
>
> Here's a minimal example:
>
>
>
> npts = 10
>
> a = findgen(2,npts)
>
> rgb = bytarr(3,npts)
>
> p1 = plot(a, vert_colors=rgb) ; works
>
> p2 = plot(a, vert_colors=rgba) ; doesn't work
>
>
>
> I'd be grateful for pointers on how to set the transparency of individual vertices
>
> in a plot.
>
>
>
> Many thanks,
>
>
>
> David
Hi David,
Looks like a bug. I'll go ahead and fix it. In the meantime, the workaround is to set the vert_colors after the plot has been created. You also need to set an rgb_table (this will also get fixed). Something like this:
npts = 10
a = findgen(2,npts)
rgba = bytarr(4,npts)
rgba[3,*] = 20b*bindgen(npts)
p2 = plot(a)
p2.rgb_table=0
p2.vert_colors=rgba
Thanks for catching this!
-Chris
ExelisVIS
|
|
|