Legend: is it possible to remove the border while leaving the background color?
47 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Gianluca Regina
am 9 Dez. 2020
Kommentiert: Gianluca Regina
am 9 Dez. 2020
Dear MatLab users,
I would like to generalize my plot legends visualization, but the legend border and background seem to interact together (see example below). In this case, the boxoff command prevails over the background color, as it disables both. Is it possible to remove ONLY the legend border while leaving the background color?
A = rand(5,1) ;
on_off = 'off' ;
legendcolor = 'r' ;
plot(A) ;
leg = legend('My text') ;
set( leg , 'fontsize' , 20 , 'location' , 'east', 'color' , legendcolor , 'box' , on_off )
grid on
0 Kommentare
Akzeptierte Antwort
Fangjun Jiang
am 9 Dez. 2020
set( leg , 'fontsize' , 20 , 'location' , 'east', 'color' , 'g' , 'box' , 'on','edgecolor','g' )
3 Kommentare
Fangjun Jiang
am 9 Dez. 2020
According to doc, "box" meant to include background and outline.
Legend box display, specified as one of these values:
- 'boxon' — Display the legend background and outline.
- 'boxoff' — Do not display the legend background and outline.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Legend finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!