MathGroup Archive 2010

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

Search the Archive

Re: More flexibility in placement of ChartLegend

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110866] Re: More flexibility in placement of ChartLegend
  • From: "Michael A. Gilchrist" <mikeg at utk.edu>
  • Date: Thu, 8 Jul 2010 20:35:15 -0400 (EDT)

Hi David,

Thanks, that's exactly what I was trying to do.  I forgot that ShowLegend uses 
more {} than just Legend which prevented my previous attempts from working.

Best,

Mike


On Thu, 8 Jul 2010, David Park wrote:

> 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
>
>
>


  • Prev by Date: Re: Pattern: x_List with conditions on elements
  • Next by Date: Re: plot colored ellipsoid
  • Previous by thread: Re: More flexibility in placement of ChartLegend
  • Next by thread: Pattern: x_List with conditions on elements