RE: How to have shaded background for just a portion of a plot?
- To: mathgroup at smc.vnet.net
- Subject: [mg45179] RE: [mg45159] How to have shaded background for just a portion of a plot?
- From: "Owen, HL (Hywel)" <H.L.Owen at dl.ac.uk>
- Date: Sat, 20 Dec 2003 05:55:43 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
It depends on the ordering of the plot and the background in any Show commands you use: e.g. here's a plot: plot = Plot[Sin[x], {x, 0, 2Pi}] This way the plot is behind the rectangles: Show[plot, Graphics[{Hue[.77], Rectangle[{0, 0}, { 5, 1}], Hue[.17], Rectangle[{3, 0}, {4, 2}]}]] This way the plot is on top of the rectangles: Show[Graphics[{Hue[.77], Rectangle[{0, 0}, {5, 1}], Hue[.17], Rectangle[{3, 0}, {4, 2}]}], plot, Frame -> True] Frame->True is ok for the axes, but you're right that the GridLines are overwritten. > -----Original Message----- > From: nafod40 [mailto:noneya at business.com] To: mathgroup at smc.vnet.net > Sent: 19 December 2003 11:57 > To: mathgroup at smc.vnet.net > Subject: [mg45179] [mg45159] How to have shaded background for just a > portion of a > plot? > > > Hola, > > Anyone know how to shade the background of just a portion of a plot? > I've tried placing shaded rectangles behind the plot using Show, > DisplayTogether, Epilog, and Prolog and all permutations > (2^4) thereof. > I have a framed and gridded plot, and I want to shade a region. > > Rectangle always overwrites the axes and grids. I would rather not > create the axes and grids myself. >