Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #1297 > unrolled thread
| Started by | Gregory Lypny <gregory.lypny@videotron.ca> |
|---|---|
| First post | 2011-03-30 09:18 +0000 |
| Last post | 2011-03-31 09:00 +0000 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
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
| From | Gregory Lypny <gregory.lypny@videotron.ca> |
|---|---|
| Date | 2011-03-30 09:18 +0000 |
| Subject | Filling Plots to the X-Axis for a Range of X Values |
| Message-ID | <imushb$icn$1@smc.vnet.net> |
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
[toc] | [next] | [standalone]
| From | Chris Degnen <degnen@cwgsy.net> |
|---|---|
| Date | 2011-03-31 08:59 +0000 |
| Message-ID | <in1fpp$4e2$1@smc.vnet.net> |
| In reply to | #1297 |
On Mar 30, 10:18 am, Gregory Lypny <gregory.ly...@videotron.ca> 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
Plot[{x^2, If[2 <= x <= 7, 0]}, {x, 0, 10},
PlotStyle -> {Automatic, None}, Filling -> {1 -> {2}}]
[toc] | [prev] | [next] | [standalone]
| From | Peter Breitfeld <phbrf@t-online.de> |
|---|---|
| Date | 2011-03-31 08:57 +0000 |
| Message-ID | <in1fle$4a2$1@smc.vnet.net> |
| In reply to | #1297 |
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
[toc] | [prev] | [next] | [standalone]
| From | Gregory Lypny <gregory.lypny@videotron.ca> |
|---|---|
| Date | 2011-03-31 09:00 +0000 |
| Message-ID | <in1fro$4gb$1@smc.vnet.net> |
| In reply to | #1297 |
Ahhh, two plots! Clever. Thank you, Chris.
Gregory
On Wed, Mar 30, 2011, at 8:04 AM, Chris Degnen wrote:
> On Mar 30, 10:18 am, Gregory Lypny <gregory.ly...@videotron.ca> 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
>
> Plot[{x^2, If[2 <= x <= 7, 0]}, {x, 0, 10},
> PlotStyle -> {Automatic, None}, Filling -> {1 -> {2}}]
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web