2
$\begingroup$

I am trying filling between of lines: $ y = x^3$, $y=0$, $x=-1$, and $x=1$. I tried.

Plot[{x^3, 0}, {x, -1, 1}, PlotRange -> {-2, 2}, 
 PlotStyle -> {Automatic, Red}, 
 Filling -> {1 -> {{2}, {LightBlue, White}}}, PlotPoints -> 100]

and got enter image description here

How can I get fill graph with x from 0 to 1?

$\endgroup$
  • 3
    $\begingroup$ Maybe change White to something you can see ? $\endgroup$ – b.gates.you.know.what Apr 14 at 5:54
  • $\begingroup$ Yes. Thank you very much. $\endgroup$ – minhthien_2016 Apr 14 at 5:56
  • 1
    $\begingroup$ Plotting a constant zero function is not necessary. Filling -> { 1 -> {Axis, LightBlue} } $\endgroup$ – LouisB Apr 14 at 6:32
3
$\begingroup$
Plot[x^3, {x, -1, 1},
  Filling -> {1 -> 0}, 
  PlotStyle -> None, 
  FillingStyle -> LightBlue]

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Alternatively, Filling -> Axis $\endgroup$ – Bob Hanlon Apr 14 at 14:21
  • $\begingroup$ @BobHanlon I chose to fill to 0 because the AxesOrigin may not always be {0,0}. $\endgroup$ – Szabolcs Apr 14 at 14:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.