Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1310

Re: Filling Plots to the X-Axis for a Range of X Values

From Peter Breitfeld <phbrf@t-online.de>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Filling Plots to the X-Axis for a Range of X Values
Date 2011-03-31 08:57 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <in1fle$4a2$1@smc.vnet.net> (permalink)
References <imushb$icn$1@smc.vnet.net>

Show all headers | View raw


Gregory Lypny wrote:

> Hello everyone,
>
> I'd like to fill a plot down to the x-axis but restrict the fill to lie between two x values, and am not sure how to do it.  For example, if I plot a parabola f[x] = x^2, with x in the range =E2=88=9210 to 10, I'd like to be able to fill to the x-axis between x = 2 and x = 7, essentially creating a filled column.  Is there any way to do that?
>
> Regards,
>
> Gregory
>
>

I think you have to make two plots and combine them with Show:

pl1 = Plot[x^2, {x, -5, 10}];
pl2 = Plot[x^2, {x, 2, 7}, Filling -> Axis];
Show[pl1, pl2]

Beware: The order of the plots in Show is critical, if you swap it, Show
will disply pl2 only, because it uses the options of the first plot given.

-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Filling Plots to the X-Axis for a Range of X Values Gregory Lypny <gregory.lypny@videotron.ca> - 2011-03-30 09:18 +0000
  Re: Filling Plots to the X-Axis for a Range of X Values Chris Degnen <degnen@cwgsy.net> - 2011-03-31 08:59 +0000
  Re: Filling Plots to the X-Axis for a Range of X Values Peter Breitfeld <phbrf@t-online.de> - 2011-03-31 08:57 +0000
  Re: Filling Plots to the X-Axis for a Range of X Values Gregory Lypny <gregory.lypny@videotron.ca> - 2011-03-31 09:00 +0000

csiph-web