Plotted data is visible under the 'northeastoutside' legend when using two y-axis and a small xlim. How can I avoid that?
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jonathan Thomet
le 21 Oct 2019
Réponse apportée : Jonathan Thomet
le 10 Déc 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 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Legend dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!