2
$\begingroup$

So I have defined two functions

s[p_] = -600 + 50 p
d[p_] = 1200 - 25 p

and I want to graph both of them on the same chart using the

Plot[{50 p - 600, -25 p + 1200}, {x, -10, 10}, PlotLegends → {"Function 1", "Function 2"}]

However, when I evaluate the cells, I get and error saying

Plot::nonopt: Options expected (instead of PlotLegends->{Function 1,Function 2}) beyond position 2 in Plot[{50 p-600,-4 p+1200},{p,-10,10},PlotLegends->{Function 1,Function 2}]. An option must be a rule or a list of rules.

Does anyone know how to fix this?

$\endgroup$
  • 1
    $\begingroup$ PlotLegends is obsolete. If you erase this part your function will be drawn $\endgroup$ – cyrille.piatecki Oct 5 '16 at 5:03
  • 1
    $\begingroup$ The problem seems to be with the arrow character (). Try deleting it and replacing it with ->. $\endgroup$ – 2012rcampion Oct 5 '16 at 5:22
3
$\begingroup$
Plot[{50 p - 600, -25 p + 1200}, {p, -10, 10}, 
PlotLegends -> Placed["Expressions", Below]]

or

Plot[{50 p - 600, -25 p + 1200}, {p, -10, 10}, 
PlotLegends -> Placed[{"f1", "g1"}, Below]]
$\endgroup$
  • 3
    $\begingroup$ Placed is not necessary; try Plot[{50 p-600,-25 p+1200},{x,-10,10},PlotLegends->{"Function 1","Function 2"}] (the original, but without the character). $\endgroup$ – 2012rcampion Oct 5 '16 at 5:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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