How to change the color of the edge line when using the "fill" function in Mathematica?

When using the fill function in Mathematica, I would like to change the style of the boundary line so that it a) is the same color as the cut line / without edge b) it is below / covered by another curve that frames the fill as a boundary line .

The current code to fill out is as follows:

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

EDIT: I edited my second question (now in bold), as it was not clear in the first version and inserted a screenshot with the “remaining” problem enter image description here

+4
source share
1 answer

Here, the Cos and Sin lines are colored the same as the fill, and they lie below the other line, if that is what you mean by “border”.

 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

Adding

Thanks for agreeing. Here's a more complete answer, after your editing:

 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

+3
source

Source: https://habr.com/ru/post/1432434/


All Articles