On Jan 30, 2:47 pm, 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
There are many ways to skin this cat. Here's the one I use:
;read the data, this is an astronomy routine:
readcol,'data.data',x,y,delim=',',/silent,count=n
xr=[0,5000] & yr=[0,5000] ;ranges for plot
plot,[0],[0],xr=xr,yr=yr,xst=9,yst=9,/nodata ;define the plot coord
system
loadct,13,/sil ;define a color table
color=230 ;a red color from the
table
;shade the region:
for i=0,n-2 do polyfill,xr(0)>[x(i),x(i+1),x(i+1),x(i)]<xr(1),$
yr(0)>[0.0,0.0,y(i+1),y(i+1)]<yr(1),$
color=color
loadct,0,/silent ;load the B&W table
oplot,x,y,ps=2 ;plot the data
plot,[0],[0],xr=xr,yr=yr,xst=1,yst=1,/noerase,$
xtit='X title',ytit='Y title'
|