Re: Plot2D: How to attach names to plotted functions
- To: mathgroup at smc.vnet.net
- Subject: [mg32262] Re: [mg32240] Plot2D: How to attach names to plotted functions
- From: BobHanlon at aol.com
- Date: Wed, 9 Jan 2002 23:37:17 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 1/9/02 4:37:12 AM,
klaus-juergen.eckardt at fujitsu-siemens.com writes:
>When plotting e.g. with the Plot2D command two functions f[x] anf g[x]
>simultaneously is it possible to order Mathematica to attach the names
>of
>the functions to the graphs? The reason is simple: it is not always obvious
>which graph belongs to which function.
>
You can use PlotStyle, Text labels, and Legends. In a bit of overkill I have
used all of these in this example
Needs["Graphics`Colors`"];
Needs["Graphics`Legend`"];
f[x_] := Sin[x];
g[x_] := Cos[x];
Plot[{f[x], g[x]}, {x, 0, 2Pi},
PlotStyle -> {{Red}, {Blue, AbsoluteDashing[{5,5}]}},
PlotLegend -> {ToString[f[x]], ToString[g[x]]},
Epilog -> {Text[ToString[f[x]], {2.4, f[2.4]}, {-1,-1}],
Text[ToString[g[x]], {5, g[5]}, {1, -1}]}];
Bob Hanlon
Chantilly, VA USA