1

What is an easy way to define a filling and a color for a curve in the subdomain going from $0$ to $1$?

Plot[x^-x, {x, 0, 4}, 
  AspectRatio -> 1/GoldenRatio, 
  Filling -> Axis, 
  FillingStyle -> Yellow]

enter image description here

I did it with Show, but is there exist easy way to use Filling or FillingStyle to do this in one plot?

Show[
  Plot[x^-x, {x, 0, 4}, AspectRatio -> 1/GoldenRatio],
  Plot[x^-x, {x, 0, 1}, 
    Filling -> Axis, 
    FillingStyle -> Yellow, 
    AspectRatio -> 1/GoldenRatio, 
    PlotRange -> {{0, 4}, {0, 1.5}}, 
    PlotStyle -> Red]]

enter image description here

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
vito
  • 8,958
  • 1
  • 25
  • 67

1 Answers1

1

Perhaps this will work for you.

Plot[{(x^-x) Boole[x <= 1], (x^-x) Boole[x > 1]}, {x, 0, 4},
  Filling -> 1 -> Axis,
  PlotStyle -> {Red, Black},
  FillingStyle -> Yellow,
  PlotRange -> {Automatic, {.001, Automatic}}]

plot

m_goldberg
  • 107,779
  • 16
  • 103
  • 257