Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: Using ShowLegend

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24967] Re: Using ShowLegend
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Mon, 28 Aug 2000 08:27:25 -0400 (EDT)
  • References: <8o4rim$f2f@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Karthik,

gr1 = Plot[{E^x, x^x, x!}, {x, 0, 3}, Frame -> True,
      AspectRatio -> 1/2, PlotStyle -> {{Hue[0]},
          {Dashing[{.02, .04}], Hue[.6]}, {Dashing[{.04, .02}], Hue[.75]}}];


legspec1 = Sequence[{{Graphics[{Hue[0], Line[{{0, 0}, {1, 0}}]}], "red"},
        {Graphics[{Dashing[5{.02, .04}], Hue[.6], Line[{{0, 0}, {1, 0}}]}],
          "blue"},
        {Graphics[{Dashing[5{.04, .02}], Hue[.75], Line[{{0, 0}, {1, 0}}]}],
          "purple"}},
      LegendShadow -> {.1, -.1}, LegendSpacing -> 0];

gr2 =ShowLegend[gr1, {legspec1, LegendPosition -> {1, -.2},
    LegendSize -> {.7, .5}}]

The position and dimension options use the Legend coordinate sytem with
origin at the center of the bounding box of the original display, gr;  the
unit in both directions is equal to half the longest side ot this bounding
box.
In the resulting display, gr2, the bounding box of gr1 shows as a thin gray
frame when the display is clicked.

LegendPosition -> {x,y} positions the lower left corner of legend box
LegendSize ->{w,h} gives width and height of legend box
LegendShadow->{x,y} gives offset of shadow from the legend box (None , gives
no shadow, and a transparent legend box)

Note that the result will have to fit inside the new image bounding box, but
the aspect ratio of the plot frame of gr1 will be kept the same.

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Karthik" <kspk at my-deja.com> wrote in message
news:8o4rim$f2f at smc.vnet.net...
> I have created a plot with 3 curves. I want to associate a legend with
> these curves - the legend must contain a full line and two broken lines
> with varying lengths of the dashes.
>
> I cannot use PlotLegend because the curves are created inside a Table
> command. ShowLegend seems to be the way to go, but I can't make
> it go thru. Can someone post a simple example of ShowLegend containing
> multiple curves with a corresponding legend?
>
> Thanks in advance.
>
> Karthik
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>




  • Prev by Date: Re: opening files
  • Next by Date: Re: Re: Undocumented Features In 4.0
  • Previous by thread: Re: Using ShowLegend
  • Next by thread: mathlink