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

MathGroup Archive 2008

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

Search the Archive

Problems with Frame in ListPlots with Legends

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91877] Problems with Frame in ListPlots with Legends
  • From: Neil Stewart <neil.stewart at warwick.ac.uk>
  • Date: Thu, 11 Sep 2008 06:15:53 -0400 (EDT)
  • Reply-to: Neil Stewart <neil.stewart at warwick.ac.uk>

Hi,

I have a problem with using Frame in a ListPlot if it has a legend.

Needs["PlotLegends"]

a = ListPlot[lowData,
  Joined -> True,
  PlotRange -> {{1, 3}, {.5, 1}},
  PlotStyle -> {Hue[0], Hue[1/3], Hue[2/3]}
  ]

 b = ListPlot[lowData,
  Joined -> True,
  Frame -> {{True, False}, {True, False}},
  FrameLabel -> {"X", "Y"},
  PlotRange -> {{1, 3}, {.5, 1}},
  PlotStyle -> {Hue[0], Hue[1/3], Hue[2/3]}
  ]

Plot a and Plot b both work. Plot b has a frame and frame labels. I can add
a legend to Plot a. Adding a legend to Plot b works, but gives errors.

l = {{{Hue[0], "1"}, {Hue[1/3], "2"}, {Hue[2/3], "3"}}, LegendPosition -> {1, 0}, LegendSize -> {0.5, 0.5}};

ShowLegend[a, l]  (* This works *)

ShowLegend[a, l] (* Makes a plot with a legend, but gives errors *)

The errors are a set of

"Axes::axes: {{True,False},{True,False}} is not a valid axis specification."

I can't work out what is going on. It works with Frame->True, but I only
want axes on the left and at the bottom, and I need frame labels.

It is a shame that the PlotLegend option does not seem to work with
ListPlot, although the documentation says it should.

Any help much appreciated.

Thanks,
Neil.



  • Prev by Date: Re: How can I get list form like this
  • Next by Date: Re: How to simplify ArcCos[x/Sqrt[x^2+y^2]] to Pi/2-ArcTan[x/Abs[y]]?
  • Previous by thread: Re: Text-based interface: Editing line input
  • Next by thread: Zoomable ListPlot