Legend on a single line not stacked vertically

112 Ansichten (letzte 30 Tage)
James
James am 16 Nov. 2011
Beantwortet: Dan Golding am 9 Jun. 2016
Sorry if this has been done before but after 30 minutes searching I can't find.
I have a figure with several vertically stacked subplots each containing one to four lines. It's in a paper where space it always at a premium; I can't waste space outside the subplots and there's not much space inside for the 'location','best' option.
Ideally I want to have the legend above the plot (title location) saying:
( linecolour caption1 linecolour caption2 )......
not
linecolour caption 1
linecolour caption 2
etc.
(putting outside right squeezes the plot and due to varying caption width the plot areas will differ so it's not a solution).
Excel can do it (not an option to use it tho). Without resorting to low level text/line commands I can't find a way to do this in MATLAB.
Clues welcome!

Antworten (3)

Dan Golding
Dan Golding am 9 Jun. 2016
These days you can just specify 'Orientation' to be 'vertical': http://www.mathworks.com/help/matlab/ref/legend.html#bt6s91s

Jan
Jan am 16 Nov. 2011
  1 Kommentar
Daniel Shub
Daniel Shub am 16 Nov. 2011
The columnlegend submission was a pick of the week a while back: http://blogs.mathworks.com/pick/2011/02/11/create-multi-column-plot-legends/

Melden Sie sich an, um zu kommentieren.


James
James am 16 Nov. 2011
thanks Jan and Daniel, the simple one works best for a quick fix, the other two don't like my strings/data form but I'll investigate the flexibility later.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by