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

Home » Public Forums » archive » polyfill
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
polyfill [message #66627] Mon, 01 June 2009 11:08 Go to next message
mandrilhot is currently offline  mandrilhot
Messages: 5
Registered: August 2007
Junior Member
Dear all,

I'm doing an eps graph and I'm using polyfill to fill the area between
two lines. However I would like the area to be gray transparent, so I
can still see what's below the filled part. How can I do?

I'm using this simple line, tryed the keyword transparent but it seems
not to be my case

polyfill,[6000,6250,6250,6000],[1.215,1.215,1.406,1.406]

Thanks!
M.
Re: polyfill [message #66720 is a reply to message #66627] Mon, 01 June 2009 16:36 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
mandrilhot@yahoo.co.uk writes:

> I'm doing an eps graph and I'm using polyfill to fill the area between
> two lines. However I would like the area to be gray transparent, so I
> can still see what's below the filled part. How can I do?
>
> I'm using this simple line, tryed the keyword transparent but it seems
> not to be my case
>
> polyfill,[6000,6250,6250,6000],[1.215,1.215,1.406,1.406]

I was curious about this, so I modified some of the
code to do this in a graphics window, which you can
find here:

http://www.dfanning.com/code_tips/transpoly.html

By just grabbing the area inside the axes, and outputting
that into the PostSript file as an image, and then putting the
axes around that, I got some results that are not too bad.

You will need the current Coyote Library code to run
this example, but I was quite surprised at how well
it turned out.

Cheers,

David

PRO Transparent_PS

; Create some data.
signal = LoadData(1) - 15
time = Findgen(N_Elements(signal)) * 6.0 / N_Elements(signal)


; Create some windows.
Window, Title='Data Window', XSIZE=400, YSIZE=400, /FREE
dataWin = !D.Window
Window, Title='Polygon Window', XSIZE=400, YSIZE=400, /FREE
polyWin = !D.Window


; Draw plot in data window.
WSet, dataWin
pos = [0.2, 0.2, 0.9, 0.9]
Plot, time, signal, BACKGROUND=FSC_Color('ivory'), $
COLOR=FSC_Color('navy'), $
/NODATA, XTitle='Time', YTitle='Signal Strength', $
POSITION=pos
OPLOT, time, signal, THICK=2, COLOR=FSC_Color('cornflower blue')
OPLOT, time, signal, PSYM=2, COLOR=FSC_Color('olive')

; Take a snapshot.
background = TVREAD(TRUE=3)


; Copy data window and draw a polygon in the polygon window.
WSet, polyWin
DEVICE, COPY=[0, 0, 400, 400, 0, 0, dataWin]
POLYFILL, [ 0, 6, 6, 0, 0], $
[-5, -5, 5, 5, -5], /DATA, $
COLOR=FSC_COLOR('deep pink')

; Take a snapshot of this window.
foreground = TVREAD(TRUE=3)

; Display the transparency.
alpha = 0.25
Window, Title='Transparent Polygon Window', $
XSIZE=400, YSIZE=400, /FREE
TV, (foreground * alpha) + (1 - alpha) * background, TRUE=3

; Do it in PostScript now.
dpos = pos
dpos[[0,2]] = pos[[0,2]] * !D.X_Size
dpos[[1,3]] = pos[[1,3]] * !D.Y_Size
inPic = TVRead(dpos[0],dpos[1],dpos[2]-dpos[0]+1,dpos[3]-dpos[1]+1)

PS_Start, FILENAME='transparent_plot.ps', XSIZE=4, YSIZE=4, $
/INCHES, /ENCAPSULATED
TVImage, inPic, POSITION=pos
Plot, time, signal, COLOR=FSC_Color('navy'), $
/NODATA, XTitle='Time', YTitle='Signal Strength', $
POSITION=pos, /NOERASE
PS_END;, /PNG
END

--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: changing the pixel values in raster
Next Topic: A neural network classifier for ENVI with GPULib

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

Current Time: Wed Oct 08 18:58:48 PDT 2025

Total time taken to generate the page: 0.00568 seconds