MathGroup Archive 2007

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

Search the Archive

Re: Legend on BarChart


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,



  • Prev by Date: entropy of an image
  • Next by Date: Re: Help: Font problem
  • Previous by thread: RE: Legend on BarChart
  • Next by thread: PlotMarkers misalignment in Mathematica 6.0.0