4

When using the filling function in Mathematica, I would like to change the style of the edge line in a way that it has a) the same color like the filling/no edge line b)it will be below/covered by another curve that frames the filling as an edge line.

Current code for the filling is as follows:

fill1 = Plot[{demand1[t1], demand1[t34]}, {t1, 0, t34}, 
Filling -> {1 -> {2}},
FillingStyle -> Directive[LightGray]];

EDIT: I have adjusted my second question (now marked bold) since it was not clear in the first version and inserted a screenshot with the "remaining" problem enter image description here

1 Answers1

3

Here the Cos & Sin lines are coloured the same as the filling, and they lie below another line, if that's what you mean by 'borderline'.

Show[Plot[{Cos[x], Sin[x]}, {x, 0, 2 Pi}, Filling -> {1 -> {2}}, 
  FillingStyle -> Directive[LightGray], PlotStyle -> LightGray],
 Plot[Sech[x], {x, 0, 2 Pi}]]

enter image description here

Addendum

Thanks for the accept. Here's a fuller answer, following your edit:

Show[Plot[{Sech[x],
   If[Sech[x] > 0.8, 0.8],
   If[Sech[x] > 0.5, 0.5],
   If[Sech[x] > 0.3, 0.3],
   If[0.5 > Sech[x] > 0.3, Sech[x]]},
  {x, 0, 2 Pi}, Filling -> {1 -> {2}, 3 -> {4}, 4 -> {5}},
  FillingStyle -> LightGray, PlotStyle -> LightGray],
 Plot[Sech[x], {x, 0, 2 Pi}, PlotStyle -> Gray],
 Plot[If[0.3 > Sech[x], Sech[x]], {x, 0, 2 Pi},
  PlotStyle -> Directive[{Thick, Black}]],
 Plot[If[0.8 > Sech[x] > 0.5, Sech[x]], {x, 0, 2 Pi},
  PlotStyle -> Directive[{Thick, Black}]],
 Map[Graphics[Style[Line[{
       {ArcSech[#], 0}, {ArcSech[#], #}}],
     Thick, Dashed, Antialiasing -> False]] &,
  {0.8, 0.5, 0.3}]]

enter image description here

Chris Degnen
  • 8,443
  • 2
  • 23
  • 40