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

Home » Public Forums » archive » Re: how to shade region of 2-D plot
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: how to shade region of 2-D plot [message #13529] Thu, 19 November 1998 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Stein Vidar Hagfors Haugan (steinhh@ulrik.uio.no) writes:

> Pixmap? I really don't get it...
>
> How about
>
> y=20*cos(findgen(50)/3)
> plot,y,ystyle=2
> bot=y-1.0
> top=y+1.0
> polyfill,[findgen(50),reverse(findgen(50))],[bot,reverse(top )],/data
> oplot,y,color=0
>
> or something? Seems simple enough for me.

Too elegant. Makes me nervous. :-)

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Progamming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: how to shade region of 2-D plot [message #13531 is a reply to message #13529] Thu, 19 November 1998 00:00 Go to previous message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
In article <MPG.10bde9e8e981acc0989688@news.frii.com>
davidf@dfanning.com (David Fanning) writes:

> Joseph Scott Stuart (nospam@ll.mit.edu) writes:
>
>> Is there a relatively painless way to shade a region on a 2-D plot?
>> Baically, I have a computed function that I want to plot with error
>> bars, and I'd like to plot the error bars as a shaded region around
>> the plotted nominal value. I could just plot error bars with the
>> points and play around with spacing between the points and the line
>> thickness of the error bars until it sort of looks like a shaded
>> region, but is there a nicer way to do it?
>
> I think I would just do this with PolyFill and specify the
> shaded region in data coordinates (Data keyword). You will have
> to draw the PolyFill areas first, but of course, you won't
> *have* the data coordinates at this point. I'd probably solve
> the problem by first drawing the plot to a pixmap to set up
> the plot scaling vectors. Then draw my shaded regions in
> the display window and plot the actual data with a NoErase
> keyword set.
>
> (Don't forget to delete that pixmap!) :-)

Pixmap? I really don't get it...

How about

y=20*cos(findgen(50)/3)
plot,y,ystyle=2
bot=y-1.0
top=y+1.0
polyfill,[findgen(50),reverse(findgen(50))],[bot,reverse(top )],/data
oplot,y,color=0

or something? Seems simple enough for me.

Regards,

Stein Vidar
Re: how to shade region of 2-D plot [message #13532 is a reply to message #13529] Thu, 19 November 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Joseph Scott Stuart (nospam@ll.mit.edu) writes:

> Is there a relatively painless way to shade a region on a 2-D plot?
> Baically, I have a computed function that I want to plot with error
> bars, and I'd like to plot the error bars as a shaded region around
> the plotted nominal value. I could just plot error bars with the
> points and play around with spacing between the points and the line
> thickness of the error bars until it sort of looks like a shaded
> region, but is there a nicer way to do it?

I think I would just do this with PolyFill and specify the
shaded region in data coordinates (Data keyword). You will have
to draw the PolyFill areas first, but of course, you won't
*have* the data coordinates at this point. I'd probably solve
the problem by first drawing the plot to a pixmap to set up
the plot scaling vectors. Then draw my shaded regions in
the display window and plot the actual data with a NoErase
keyword set.

(Don't forget to delete that pixmap!) :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Progamming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Creating a Run-Time IDL Application
Next Topic: Re: Dumb Dumb Question

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

Current Time: Fri Oct 10 23:16:48 PDT 2025

Total time taken to generate the page: 0.85452 seconds