Re: LegendPosition Problem
- To: mathgroup at smc.vnet.net
- Subject: [mg68843] Re: LegendPosition Problem
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Mon, 21 Aug 2006 03:27:41 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <ec9828$4fi$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Paul Townley-Smith wrote:
> I'm running 5.2 and trying to position a legend. No matter what coordinates
> I give, the legend is always in the bottom left...what am I doing wrong.
> The following sample code below puts the legend in the lower left on my
> machine, even though this is supposed to be an example where the legend is
> in the in middle right.
> ShowLegend[
> DensityPlot[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, Mesh -> False,
> PlotPoints -> 30, DisplayFunction -> Identity], {GrayLevel[1 - #] &, 10,
> " 1", "-1", LegendPosition -> {1.1, -.4}}]
Hi Paul,
On my system, the code you gave works like a charm: the legend is
displayed on the middle-right of the diagram. Have you loaded any other
packages in addition to Graphics`Legend that might conflict with the
definition of ShowLegend? Try with a fresh kernel and do not load any
packages except Graphics`Legend. See what happens then.
Needs["Graphics`Legend`"]
ShowLegend[ DensityPlot[ Sin[ x y], { x,0,Pi}, { y,0,Pi}, Mesh->False,
PlotPoints->30, DisplayFunction->Identity], { GrayLevel[ 1-#]&,10,"
1","-1", LegendPosition-> { 1.1, -.4}}];
$Version
--> "5.2 for Microsoft Windows (June 20, 2005)"
HTH,
Jean-Marc