1
$\begingroup$

I'd like to mark a region in my plot and after some research in the internet I found the solution I was looking for using the Filling option.

f1 [x_] := Sin[x]

f2 [x_] := Cos[x]

lb := -.4

ub := .3

f1[0]

f2[0]

Plot[ { lb, f1[x], f2[x]}, {x, 0 - Pi, Pi}, 
 PlotStyle -> Join[ {None}, ColorData[97, "ColorList"]], 
 Filling -> {1 -> {ub, LightBlue}}, PlotLegends -> {"Sin", "Cos"}]

The result is here

enter image description here

As you can see, the label "Sin" has no color and "Cos" has the color of "Sin" (because Cos[0]=1.0). Any ideas?

Thanks, Jörg

$\endgroup$

closed as off-topic by Alexey Popkov, Coolwater, m_goldberg, Bob Hanlon, Öskå Aug 22 at 20:38

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Alexey Popkov, Coolwater, m_goldberg, Bob Hanlon, Öskå
If this question can be reworded to fit the rules in the help center, please edit the question.

2
$\begingroup$

Use

PlotLegends -> {None, "Sin", "Cos"}

enter image description here

$\endgroup$
  • $\begingroup$ Perfect. Stupid me. $\endgroup$ – osx Aug 21 at 6:45

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