Re: Legend on BarChart
- To: mathgroup at smc.vnet.net
- Subject: [mg81212] Re: Legend on BarChart
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sun, 16 Sep 2007 04:01:11 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <fcg3p7$rap$1@smc.vnet.net>
tomfabtastic at hotmail.com wrote:
> I'm using version 6 and would like to add a legend to a BarChart. I
> found the below example on this site. It works but produces a raft of
> errors :
>
> << Graphics`Legend`
> << Graphics`Graphics`
> ShowLegend[
> BarChart[{1, -3, 4, 5, 2, 3}, {3, 6, 4,
> 3}], {{{Hue[0],
> StyleForm["First", FontFamily -> "Times", FontSize -> 12,
> FontWeight -> "Bold"]}, {Hue[0.6],
> StyleForm["Second", FontFamily -> "Times", FontSize -> 12,
> FontWeight -> "Bold"]}}, LegendPosition -> {1.1, -0.5}}]
>
> Is there a better method to add a Legend to a BarChart in version 6 ?
The above example is for version 5 and below. The packages
Graphics`Legend` and Graphics`Graphics` are obsolete in version 6. Use
(and read the documentation) for the new packages PlotLegends` and
BarCharts`. For instance, the above example should start with
Needs["PlotLegends`"]
Needs["BarCharts`"]
ShowLegend[ ... your graphic primitives here ... ]
http://reference.wolfram.com/mathematica/PlotLegends/guide/PlotLegendsPackage.html
--
Regards,