Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

How can I put a chart legend inside a bar chart? I tried Placed[ ... ,{Right,Top}], but it didn't work. It works for Plot. However, it doesn't work for BarChart.

share|improve this question

closed as off-topic by Jacob Akkerboom, ciao, bobthechemist, Michael E2, ubpdqn Mar 30 '14 at 9:42

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Jacob Akkerboom, ciao, bobthechemist, Michael E2, ubpdqn
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

Here are some examples:

  BarChart[{{1, 2, 3}, {4, 5, 6}}, 
    ChartLegends -> 
      Placed[{{"Group A", "Group B"}, None}, {#}], ChartStyle -> {"Pastel", None}] & /@ 
        {Left, Right, Top, Bottom, {0.2, 0.7}}, 
  Frame -> All]

enter image description here

share|improve this answer
Looking good :) –  Jacob Akkerboom Mar 26 '14 at 12:45
When I want to export the figure, the legends are not included. –  yashar Mar 26 '14 at 12:49
@yashar The above graphic was created by exporting the code in the post...I am uncertain what the issue is. However, there are a number of posts on MSE on the exporting of graphics with legends that may be helpful. –  ubpdqn Mar 26 '14 at 12:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.