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

Home » Public Forums » archive » Fill the under of a x-y plot
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: Fill the under of a x-y plot [message #79123 is a reply to message #79060] Wed, 01 February 2012 22:14 Go to previous messageGo to previous message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Jan 31, 3:21 pm, alx <lecacheux.al...@wanadoo.fr> wrote:
> On 30 jan, 20:47, DavePoreh <d.po...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
>> Folks
>> hi,
>> I have a x-y plot and i want to fill under of the graph with a polygon
>> with a specified color. i saw an example in help but i do not know how
>> to do that in my case. can sb help pls. my data is st like this:
>> 0,4564.723
>> 130.85,4570.745
>> 261.7,4503.422
>> 392.55,4427.584
>> 523.4,4352.976
>> 654.25,4292.612
>> 785.1,4250.424
>> 915.95,4216.291
>> 1046.8,4203.354
>> 1177.6,4202
>> 1308.5,4202
>> 1439.3,4228.552
>> 1570.2,4243.332
>> 1701,4233.284
>> 1831.9,4244.947
>> 1962.7,4254.814
>> 2093.6,4289.623
>> 2224.4,4279.751
>> 2355.3,4258.601
>> 2486.1,4243.937
>> 2617,4220.519
>> 2747.8,4208.247
>> 2878.7,4203.115
>> 3009.5,4210.122
>> 3140.4,4234.804
>> 3271.2,4256.684
>> 3402.1,4275.718
>> 3532.9,4304.727
>> 3663.8,4303.549
>> 3794.6,4263.894
>> 3925.5,4207.462
>> 4056.3,4157.35
>> 4187.2,4109.001
>> 4318,4066.732
>> ............
>
>> Cheers,
>> Dave
>
> You may add a polygon annotation, as follows:
>
> in DG:
> device, DECOMPOSED=0
> loadct,0
> plot,x,y,/XST,XTICKLEN=-0.03,YTICKLEN=-0.02,/YNOZERO
> polyfill,[x[0],x,x[-1]],[!Y.CRange[0],y,!Y.CRange[0]],COL=10 0
> plot,x,y,/XST,XTICKLEN=-0.03,YTICKLEN=-0.02,/YNOZERO,/NOERAS E
>
> in NG:
> pl=plot(x,y,/XTICKDIR,/YTICKDIR,XSTYLE=1)
> poly=polygon([x[0],x,x[-1]],[0,y,0],/DATA,/
> FILL_BACKGROUND,FILL_COLOR='light_grey')
>
> The trick is to complete your data, so that the polygon get closed.
> In DG, some cosmetics is needed.
>
> alx.

Thanks Alx
I did st like this:

p1 = plot(a(0,*)/1000, a(1,*), COLOR='blue', /XTICKDIR, /YTICKDIR,
THICK=3)
poly1 = polygon([a(0,*)[0],a(0,*),a(0,*)[-1]], [0,a(1,*),0], /DATA,/
FILL_BACKGROUND,FILL_COLOR='light_grey')
/FILL_BACKGROUND, FILL_COLOR=!COLOR.DEEP_PINK, FILL_TRANSPARENCY=50)

but i have got my plot and a big polygon covers it!!!
what is wrong with that?
Cheers,
Dave
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: creating variables in a FOR loop
Next Topic: Coyote Library Update

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

Current Time: Sat Oct 11 09:00:12 PDT 2025

Total time taken to generate the page: 0.04889 seconds