Plotted data is visible under the 'northeastoutside' legend when using two y-axis and a small xlim. How can I avoid that?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jonathan Thomet
am 21 Okt. 2019
Beantwortet: Jonathan Thomet
am 10 Dez. 2019
Hi all,
I may have a problem with the print() function with a special case. Here is the end result.

As you can see, when I x-zoom on my data with two y-axis and a legend outside, while Matlab's figure window will look OK, some of the data will appear in the region under the legend outside the plot area when I print it. Obviously, with the print function, I want the area under the legend to be blank! I have the intuition this is a problem of the print() function, since Matlab's figure window doesn't show this kind of behavior. Maybe this would need a patch from Matlab?
Here is the code I used to create this file:
ffgg = set(figure,'defaultAxesColorOrder',[[0 0 0]; [0 0 0]]);
yyaxis left
plot([0 1 2 3 4 5 6 7 8 9], [1 5 4 6 8 2 9 3 5 3])
hold on
yyaxis right
stem([2 4 6 8],[50 30 60 40])
legend('Location','northeastoutside');
xlim([0 5]) % Up to here, Matlab's figure window looks good!
print('test','-djpeg')
I am using Matlab R2019a - academic use, Update 4 (9.6.0.1150989), on a Windows 10 Education computer, 64 bit. Thank you for any help.
0 Kommentare
Akzeptierte Antwort
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!