MathGroup Archive 2008

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

Search the Archive

Re: Problem for using "Epilog" to plot legend

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87539] Re: Problem for using "Epilog" to plot legend
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sat, 12 Apr 2008 07:01:22 -0400 (EDT)

On 4/11/08 at 1:43 AM, davis.v.liu at gmail.com (davis) wrote:

>i want to use "Epilog" to plot a legend,but i have a problem for the
>"Line" command.

>ListPlot[{{1, 2, 3, 5, 8}, {2, 3, 6, 9, 10}}, Joined -> True,
>PlotMarkers -> Automatic, Epilog -> Inset[Framed@
>Column[{Graphics[{DotDashed, Line[{{1, 0}, {2, 0}}]}] Style["a"],
>Graphics[{Dotted, Line[{{1, 0}, {2, 0}}]}] Style["b"]}, Spacings ->
>0, ItemSize -> {15, 0.5}], {1.25, 7}]]

>the space between different rows in "legend area" are really large,

>but if i change the Line condition,such like below

>ListPlot[{{1, 2, 3, 5, 8}, {2, 3, 6, 9, 10}}, Joined -> True,
>PlotMarkers -> Automatic, Epilog -> Inset[Framed@
>Column[{Graphics[{DotDashed, Line[{{100, 0}, {2, 0}}]}] Style["a"],
>Graphics[{Dotted, Line[{{100, 0}, {2, 0}}]}] Style["b"]}, Spacings
>-> 0, ItemSize -> {15, 0.5}], {1.25, 7}]]

>the rows became close to each other, but the length of the lines
>became too long

>how can i solve this?

My approach would be to use Text instead of Style and specify
placement of all of the elements rather than use Column to line
things up. For example,

ListPlot[{{1, 2, 3, 5, 8}, {2, 3, 6, 9, 10}}, Joined -> True,
  PlotMarkers -> Automatic,
  Epilog ->
   Inset[Framed@
     Graphics[{DotDashed, Line[{{5, 0}, {2, 0}}],
       Text["a", {5.1, 0}, {1, 0}], Dotted,
       Line[{{5, -.5}, {2, -.5}}],
       Text["b", {5.1, -.5}, {1, 0}]}], {1.5, 7}, {0, 0}, 1.5]]


  • Prev by Date: RE: Product
  • Next by Date: Re: A Problem with Simplify
  • Previous by thread: Re: Problem for using "Epilog" to plot legend
  • Next by thread: Re: Problem for using "Epilog" to plot legend