How do I change the colors and styles of two functions that are graphed on the same set of axes? The color and style needs to be different for each function, but they must be on the same graph. The screenshot I attached is what I have graphed so far. F[x] needs to be purple and dashed. And H[x] needs to be red and thick.
(please help I’ve been trying to figure this out for 4 hours!)
Add inside Plot command: PlotStyle->{{Dashed,Purple},{Thick,Red}}
Quick comments:
-
your definition of
Graphshould not be a delayed evaluation (:=), it should be an immediate evaluation (=). -
you should use
graphrather thanGraph.Graphis a reserved Mathematica symbol. Generally it is a good idea to define your symbols starting with a lowercase letter to avoid this. -
A safer and more powerful and unambiguous way to use
PlotStyleis withDirectiveas ingraph = Plot[{x, x^2}, {x, -3, 3},
PlotStyle → {Directive[Purple, Thick, Dashed], Directive[Pink, Thick, Opacity[0.5]]}]
I typed in PlotStyle → {{Purple, Dashed}, {Red, Thick}} (the program wanted the colors to go before the styles) at the end of the plot command and it just made the functions disappear from the graph completely
That makes sense to me, but seemingly not to the program, as the functions have disappeared yet again
It should work perfectly fine. However if you have not defined and executed your functions F and G in your current Mathematica session (not good names ass per my earlier suggestion) then you will get a blank graph. It would help if you posted your code as without it is is not easy to debug
actually i just did it!! I had to go back up and redefine the functions and then after that it worked! thank you SO much!