MathGroup Archive 2008

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

Search the Archive

Creating a Legend with ListPlot using PlotMarkers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84809] Creating a Legend with ListPlot using PlotMarkers
  • From: Uayeb <uayebswinburne at gmail.com>
  • Date: Tue, 15 Jan 2008 03:17:56 -0500 (EST)

I'm trying to create a legend for a list plot of points using the
PlotMarkers generated with the option PlotMarkers->Automatic. Seems
the only way to do this is by creating my own set of plot markers
which I can hand both to the ListPlot[data,PlotMarkers->myMarkers] and
to the Legend[Table[{myMarkers[[i]],"data "<>ToString[i]},
{i,Length[myMarkers]}]] (or similar) call. Seems that the
Automatically generated markers should be around somewhere, similar to
how the colors used to generate a line plot are in ColorData[1,i].

Also, drawing a box around the legend via LegendShadow->{0,0} has
unexpected results:

data = Table[RandomReal[] + 8, {2}, {6}]
plot = ListPlot[data, PlotMarkers -> Automatic, PlotStyle -> Black,
  Axes -> False, Frame -> True]
Show[plot,
 Graphics[Legend[{{Graphics[{Inset[
        Style["\[FilledSquare]", FontSize -> 8.96], {0, 0}]}],
     "DEEP2"}, {Graphics[{Inset[
        Style["\[FilledCircle]", FontSize -> 8.96], {0, 0}]}],
     "CFRS"}}, LegendShadow -> {0, 0}, LegendPosition -> {1, 8.7}]]]

This code produces a Boxed Legend, but the box expands to touch the
top of the plot frame. Looking at the InputForm of the output gives no
indication that this shouldn't draw correctly.

Cheers,
Andy


  • Prev by Date: Re: Problem with Distribution Functions
  • Next by Date: Re: Keyboard shortcut
  • Previous by thread: Re: Convex hull iin 3-D, anyone?
  • Next by thread: Re: Creating a Legend with ListPlot using PlotMarkers