Re: More flexibility in placement of ChartLegend
- To: mathgroup at smc.vnet.net
- Subject: [mg110852] Re: More flexibility in placement of ChartLegend
- From: "David Park" <djmpark at comcast.net>
- Date: Thu, 8 Jul 2010 07:41:13 -0400 (EDT)
data1 = RandomReal[NormalDistribution[0, 1], 500];
data2 = RandomReal[NormalDistribution[3, 1/2], 500];
color1 = RGBColor[0.2472`, 0.24`, 0.6`];
color2 = RGBColor[0.6`, 0.24`, 0.4428931686004542`];
ShowLegend[
Histogram[{data1, data2}],
{{{Directive[Opacity[.7, color1]], "data 1"},
{Directive[Opacity[.7, color2]], "data 2"}},
LegendPosition -> {-0.8, 0.3},
LegendSize -> {0.7, 0.2},
LegendTextOffset -> {-0.6, 0},
LegendSpacing -> 0.6}]
And using Presentations, or Epilog, you could also construct your own custom
legend by drawing small rectangles and text directly on the plot.
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/
From: Michael A. Gilchrist [mailto:mikeg at utk.edu]
Hi,
I've been working with the Histogram[] function and want to include a legend.
According to Mathematica's mystical ways the option Legend does not work with
Histogram[]. Instead one needs to use a ChartLegend which has a different
syntax and only a few options for placement (Top, Bottom, Center).
My question: "Is there an easy way to finely control the placement of a legend
in Histogram[]?"
I've spent a couple of hours messing aroudn with Legend[], Inset[], Show[],
ShowLegend[] and Graphics[], but to no avail. Any insights or suggestions
would be welcome.
Thanks in advance.
Mike