RE: How to have shaded background for just a portion of a plot?
- To: mathgroup at smc.vnet.net
- Subject: [mg45189] RE: [mg45159] How to have shaded background for just a portion of a plot?
- From: "John C. Erb, Ph.D." <John_C_Erb at prodigy.net>
- Date: Sat, 20 Dec 2003 05:55:54 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Try the Rectangle function. To make an area of some color, you could make a plot where the plot is in the same color as the background. For Example plotOne=Plot[Sin[x],{x,0,2Pi},Axes->False, PlotStyle->{RGBColor[1,0,0]},Background->RGBColor[1,0,0]]; Then have your main plot. For example plotTwo=Plot[Cos[x],{x,0,2Pi}]; Then Show these together using the Rectangle function Show[Graphics[{Rectangle[{0,0},{1,1},plotTwo], Rectangle[{0.45,0.55},{0.75,0.9},plotOne]}]]; You could use $DisplayFunction->Identity, if you didn't want to display the plotOne and plotTwo separately, but only the combined plot. I can't take credit for this idea. See Applied Mathematica, Getting It Started Getting It Done, By Shaw & Tigg, Section 5.21. John C. Erb Email: John_C_Erb at prodigy.net -----Original Message----- From: nafod40 [mailto:noneya at business.com] To: mathgroup at smc.vnet.net Subject: [mg45189] [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.