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.

The following way will put the legends on the right of the figure, and the three legends are vertically aligned.

Plot[{x, x^2, x^3}, {x, 0, 3}, Frame -> True, 
  PlotLegends -> {"long text 1", "long text 2", "long text 3"}]

enter image description here

The following way will put the legends above the figure, but the three legends are in one line, instead of three lines.

Plot[{x, x^2, x^3}, {x, 0, 3}, Frame -> True, 
  PlotLegends -> Placed[{"long text 1", "long text 2", "long text 3"}, Above]]

enter image description here

How to get a figure such that the legends are above the figure (like the second figure), and they are vertically aligned in multiple lines (like the first figure)?

share|improve this question

closed as off-topic by Öskå, Michael E2, ubpdqn, bobthechemist, rasher Jul 3 at 21:36

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." – Öskå, Michael E2, ubpdqn, bobthechemist, rasher
If this question can be reworded to fit the rules in the help center, please edit the question.

    
It's in the docs here. –  Öskå Jul 3 at 10:50
1  
I think a V9 reference might be more appropriate at this point: reference.wolfram.com/mathematica/ref/SwatchLegend.html –  Michael E2 Jul 3 at 12:41

2 Answers 2

up vote 3 down vote accepted
Plot[{x, x^2, x^3}, {x, 0, 3}, Frame -> True,
 PlotLegends -> Placed[LineLegend[ColorData[1] /@ Range[3],
    {"long text 1", "long text 2", "long text 3"},
    LegendLayout -> "Column"], Above]]

enter image description here

share|improve this answer
Plot[{x, x^2, x^3}, {x, 0, 3}, Frame -> True, 
 PlotLegends -> 
  Placed[SwatchLegend[{"long text 1", "long text 2", "long text 3"}, 
    LegendMarkers -> "Line", 
    LegendLayout -> "Column"], {{0.5, 1.3}, {0.5, 1}}]]

enter image description here

share|improve this answer

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