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

Home » Public Forums » archive » Re: Filled area curve
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Filled area curve [message #85670] Mon, 26 August 2013 05:42 Go to next message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Monday, 26 August 2013 14:15:40 UTC+2, Rob Dimeo wrote:
> Hi,
>
> A quick search on this NG came up fruitless but I'm hoping that someone has done this type of plot before.
>
> David has a very nice example of a curve with part of the area under it filled with a solid color: http://www.idlcoyote.com/gallery/filled_area_plot.png
>
> I would like to extend this so that the area is actually a sequence of colors, the value of which is tied to the independent variable. I intend to plot the magnitude of a complex function, |z(x)|, (as a function of some independent variable, x) as the "curve" and encode the phase angle (again, as a function of x) as a filled (generally multiple-) color area below the curve.
>
>
>
> So the main difference from the plot shown in the link above would be that the solid color that fills the area under the curve would instead be a gradient of colors that transition from one x-value to another, depending on the value of x and the color table used.

Something like this could be a starting point for you:

x = dindgen(360)/359
phase = x^2*4*!dpi
mag = abs(sin(2*!dpi*x))
z = mag*exp(complex(0,1)*phase)

col=bytscl(atan(z, /phase))

device, get_decomposed=decomp_flag

device, decomposed=1
plot, x, mag, /nodata
loadct, 33
device, decomposed=0
for ii=0, n_elements(x)-2 do polyfill, x[[ii, ii+1, ii+1, ii]], [0,0,mag[ii+1], mag[ii]], color=col[ii]
device, decomposed=1
oplot, x, mag, thick=2

device, decomposed=decomp_flag

--
Yngvar
Re: Filled area curve [message #85671 is a reply to message #85670] Mon, 26 August 2013 05:54 Go to previous messageGo to next message
Rob.Dimeo is currently offline  Rob.Dimeo
Messages: 21
Registered: September 2007
Junior Member
Many thanks. That's nice, simple, and does the trick.
-Rob

On Monday, August 26, 2013 8:42:36 AM UTC-4, Yngvar Larsen wrote:

> Something like this could be a starting point for you:
>
>
>
> x = dindgen(360)/359
>
> phase = x^2*4*!dpi
>
> mag = abs(sin(2*!dpi*x))
>
> z = mag*exp(complex(0,1)*phase)
>
>
>
> col=bytscl(atan(z, /phase))
>
>
>
> device, get_decomposed=decomp_flag
>
>
>
> device, decomposed=1
>
> plot, x, mag, /nodata
>
> loadct, 33
>
> device, decomposed=0
>
> for ii=0, n_elements(x)-2 do polyfill, x[[ii, ii+1, ii+1, ii]], [0,0,mag[ii+1], mag[ii]], color=col[ii]
>
> device, decomposed=1
>
> oplot, x, mag, thick=2
>
>
>
> device, decomposed=decomp_flag
>
>
>
> --
>
> Yngvar
Re: Filled area curve [message #85855 is a reply to message #85670] Fri, 13 September 2013 21:55 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Monday, August 26, 2013 8:15:40 AM UTC-4, Rob Dimeo wrote:
> Hi,
>
>
>
> A quick search on this NG came up fruitless but I'm hoping that someone has done this type of plot before.
>
>
>
> David has a very nice example of a curve with part of the area under it filled with a solid color: http://www.idlcoyote.com/gallery/filled_area_plot.png
>
>
>
> I would like to extend this so that the area is actually a sequence of colors, the value of which is tied to the independent variable. I intend to plot the magnitude of a complex function, |z(x)|, (as a function of some independent variable, x) as the "curve" and encode the phase angle (again, as a function of x) as a filled (generally multiple-) color area below the curve.
>
>
>
> So the main difference from the plot shown in the link above would be that the solid color that fills the area under the curve would instead be a gradient of colors that transition from one x-value to another, depending on the value of x and the color table used.

I realize that I'm a couple weeks late to the game.

For future reference, consider PLOTCOLORFILL,
http://www.physics.wisc.edu/~craigm/idl/graphics.html#PLOTCO LORFILL
which appears to do exactly what you want!

Craig
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: generating sequences
Next Topic: Question about CURVEFIT function

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

Current Time: Wed Oct 08 18:49:42 PDT 2025

Total time taken to generate the page: 0.01351 seconds