Message Boards Message Boards


Plotting multiple lines and using filling on only one line

Posted 10 years ago
4 Replies
3 Total Likes
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
4 Replies
Glad Sean and I could help. Thanks for using Mathematica!
POSTED BY: Arnoud Buzing
Posted 10 years ago

That does exactly what I need!  Thank you!

POSTED BY: Allen Hammack
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}];

POSTED BY: Sean Clarke
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
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract