Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

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: [mg87554] Re: Problem for using "Epilog" to plot legend
  • From: "David Park" <djmpark at comcast.net>
  • Date: Sat, 12 Apr 2008 07:04:12 -0400 (EDT)
  • References: <ftmtuu$4ob$1@smc.vnet.net>

I didn't quite see what the legend had to do with the plot. But in any case, 
with Presentations it is convenient to simply draw the legend lines on the 
plot as additional elements.

Needs["Presentations`Master`"]

Draw2D[
 {ListDraw[{{1, 2, 3, 5, 8}, {2, 3, 6, 9, 10}}, Joined -> True,
   PlotMarkers -> Automatic,
   PlotStyle -> {Black, Darker@Red}],
  (* Draw legend *)
  Black, Line[Scaled /@ {{.1, .8}, {.3, .8}}],
  Text["a", Scaled[{.35, .8}]],
  Darker@Red, Line[Scaled /@ {{.1, .7}, {.3, .7}}],
  Text["b", Scaled[{.35, .7}]]},

 AspectRatio -> 1/GoldenRatio,
 Axes -> True,
 PlotRange -> {{0, 5.1}, {0, 10}},
 BaseStyle -> {FontSize -> 12}]

Or, in this case, it might be more direct to simply label the two curves. 
Version 6.0.2 has a graphics tool for picking off coordinates (but it gives 
you an extra set of  brackets that must be edited out) and Presentations has 
a LocatorDraw feature that gives you a temporary Locator and display for 
picking off coordinates.

Draw2D[
 {ListDraw[{{1, 2, 3, 5, 8}, {2, 3, 6, 9, 10}}, Joined -> True,
   PlotMarkers -> Automatic,
   PlotStyle -> {Black, Darker@Red}],
  (* Label Curves *)
  Text[Style["a", 16], {4.26069, 6.55068}],
  Text[Style["b", 16], {3.14569, 7.37447}]},

 AspectRatio -> 1/GoldenRatio,
 Axes -> True,
 PlotRange -> {{0, 5.1}, {0, 10}},
 BaseStyle -> {FontSize -> 12},
 ImageSize -> 350]



-- 
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/


"davis" <davis.v.liu at gmail.com> wrote in message 
news:ftmtuu$4ob$1 at smc.vnet.net...
> Dear Group
>
> 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?
>
> thank you
> 



  • Prev by Date: Re: Tilted decimals on the x-axis to avoid overlapping
  • Next by Date: Re: Just primitive ColorFunction
  • Previous by thread: Re: Problem for using "Epilog" to plot legend
  • Next by thread: ContourPlot, etc.: not every point a Real