Re: Problems with ShowLegend
- To: mathgroup at smc.vnet.net
- Subject: [mg78715] Re: [mg78662] Problems with ShowLegend
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sat, 7 Jul 2007 06:10:32 -0400 (EDT)
- Reply-to: hanlonr at cox.net
Did you load the PlotLegends package? Needs["PlotLegends`"]; {g6, g10, g14, g16} = Table[Plot[n*x, {x, 0, 1}, PlotStyle -> {Red, Blue, Green, Yellow}[[n]]], {n, 4}]; g = Show[g6, g10, g14, g16]; ShowLegend[g, {{{Red, "Vt=6Knots"}, {Blue, "Vt=10Knots"}, {Green, "Vt=14Knots"}, {Yellow, "Vt=16Knots"}}}, LegendPosition -> {1, 1}] g = Plot[Evaluate[Table[n*x, {n, 4}]], {x, 0, 1}, PlotStyle -> {Red, Blue, Green, Yellow}]; ShowLegend[g, {{{Red, "Vt=6Knots"}, {Blue, "Vt=10Knots"}, {Green, "Vt=14Knots"}, {Yellow, "Vt=16Knots"}}}, LegendPosition -> {1, 1}] Bob Hanlon ---- mattew <m_manni_m at hotmail.com> wrote: > Hi everybody, firstable thanks for answering in my previous post even if, as you let me noticed, I could have solved the problem by myself having a look at the basics of mathematica (even if the first approach is quite difficult!). > Now I'm experimenting troubles with ShowLegend, and I tried hard to make it work but the documentation is terrible...i tried to copy an example that DH posted in a previous discussion: > > ShowLegend[g, {{{Red, "Vt=15Knots"}, {Blue, "Vt=10Knots"}, {Green, > "Vt=14Knots"}, {Yellow, "Vt=6Knots"}}}, LegendPosition -> {1, 1}] > > where g is the result of > > g = Show[g6, g10, g14, g16] > > a Show command over four previous plotted graphics (it works without problems). > > All I get back from the code I posted above is the following output: > > ShowLegend[ /*here comes a little figure representing g*/, > {{{RGBColor[1, 0, 0], "Vt=15Knots"}, {RGBColor[0, 0, 1], > "Vt=10Knots"}, {RGBColor[0, 1, 0], > "Vt=14Knots"}, {RGBColor[1, 1, 0], "Vt=6Knots"}}}, > LegendPosition -> {1, 1}] > > while I should have, I guess, my graphic g back with the legend on it...any idea of what I'm missing? >