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 #79132 is a reply to message #79060] Tue, 31 January 2012 15:21 Go to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
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.
[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 02:58:03 PDT 2025

Total time taken to generate the page: 2.39783 seconds