MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Problems with ShowLegend

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78838] Re: [mg78788] Re: Problems with ShowLegend
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Wed, 11 Jul 2007 06:02:55 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <f6krnr$l77$1@smc.vnet.net> <200707101018.GAA26623@smc.vnet.net>
  • Reply-to: murray at math.umass.edu

In Mathematica 6, you could avoid the first Line expression (which forms 
the rectangle to enclose the legend) by wrapping g4 with Framed.  Of 
course you'd then need to change the second argument of Inset to, say, 
{8.1,-0.575}.

The results will not be identical to what dh's code, with the Line, 
provide: for reasons I do not understand, when you use Framed, the 
line-text items seem to be spaced farther apart vertically.

dh wrote:
> 
> if you want to have a fancier legend than ShowLegend offers, you have to 
> 
> do it yourself. E.g. if you want lines:
> 
> 
> g1=Plot[Sin[x],{x,0,10}];
> g2=Plot[Tan[x],{x,0,10}];
> g3=Show[{g1,g2}];
> g4=Graphics[{ Line[{{0,0},{1.5,0},{1.5,1},{0,1},{0,0}}],
> Line[{{0.2,0.8},{0.6,0.8}}],Text["First Line",{1,.8}],Dashing[{.01,.01}],
> Line[{{0.2,0.6},{0.6,0.6}}],Text["SecondLine",{1,.6}],Dashing[{.02,.01}],
> Line[{{0.2,0.4},{0.6,0.4}}],Text["First Line",{1,.4}],Dashing[{.02,.02}],
> Line[{{0.2,0.2},{0.6,0.2}}],Text["First Line",{1,.2}]}] ;
> Show[g3,Epilog->{Inset[g4,{6.25,-1},{0,0},4,Background->White]}]

> 
> mattew wrote:
>> 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?

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: T Copula Calibration
  • Next by Date: Re: the FontType option
  • Previous by thread: Re: Problems with ShowLegend
  • Next by thread: Problems with Filled Symbols and PlotMarkers