Group Abstract Group Abstract

Message Boards Message Boards

Plotting multiple lines and using filling on only one line

GROUPS:
I am trying to plot multiple curvers using the "Plot" function.  I would like to shade below one of the curves, but not fill for any other curves.  The line in my Mathematica notebook is "Plot[{V, -0.5, 0.5, 2, 8, 16}, {x, -3, 3}, Filling -> Bottom]".  I can't seem to get the horizontal lines to plot without them filling.  Could someone please tell me what fill options I need to use to be able to fill according to one line, but have no fill for other lines plotted on the same plot?
POSTED BY: Allen Hammack
Answer
11 months ago
You mean like this?
Plot[{8 Sin[x], -0.5, 0.5, 2, 8, 16}, {x, -3, 3},
Filling -> {1 -> Axis}]
POSTED BY: Arnoud Buzing
Answer
11 months ago
The Filling option can take a list of rules that describes the filling. This one says for example to only fill from the first function to the bottom:
Plot[{Sin[x], 0.1, 0.3}, {x, 0, 10}, Filling -> {1 -> Bottom}]
If you are not comfortable with the Filling syntax, make multiple Plots and put them together with Show:
p1=Plot[Sin[x], {x, 0, 10}, Filling->Bottom];
p2=Plot[{0,1,0.3}, {x, 0, 10}];

Show[p1,p2]
POSTED BY: Sean Clarke
Answer
11 months ago
Arnoud,

That does exactly what I need!  Thank you!

Allen
POSTED BY: Allen Hammack
Answer
11 months ago
Glad Sean and I could help. Thanks for using Mathematica!
POSTED BY: Arnoud Buzing
Answer
11 months ago