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

Home » Public Forums » archive » Re: Color background with 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: Color background with PLOT [message #51436 is a reply to message #51435] Sat, 18 November 2006 09:32 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matt Harner writes:

> I'd like to have a color background on a plot using direct graphics.
> Instead of the built in background using the BACKGROUND keyword to
> PLOT, I'd like the background to only be behind the plotted data, not
> the entire window (axis, ticks, title, etc). The only way I have found
> to do this is to draw a colored box with POLYFILL in the area that I
> desire, but then the axis tick marks are under the polygon. Is there
> any way to do this while still maintaining the plot tick marks?

If you position your plot with the POSITION keyword, then
you can draw your background polygon first into that position,
then draw your plot with the NOERASE keyword set. (You might
have to erase the window first with the ERASE command. This
would be a good time to get the area outside the polygon
the color you want, since you can use the COLOR keyword
here as well.)

Direct graphics commands just put pixels on top of pixels,
so sometimes you have to "layer" your graphics commands
to achieve the results you want. The NOERASE keyword is
a great help when you are re-drawing axis tick marks and
the like. :-)

Erase, COLOR=FSC_COLOR('ivory')
p = [0.15, 0.15, 0.9, 0.9]
PolyFill, [p[0],p[0],p[2],p[2],p[0]], $
[p[1],p[3],p[3],p[1],p[1]], $
COLOR=FSC_COLOR('sky blue'), /NORMAL
Plot, findgen(11), COLOR=FSC_COLOR('red'), $
POSITION=p, /NOERASE

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Image warping in IDL
Next Topic: Issue with 6.3, Mac OS X 10.4, 3 displays, X11

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

Current Time: Fri Oct 10 17:50:34 PDT 2025

Total time taken to generate the page: 0.24276 seconds