How to reduce the size of legend in a fig file?
27 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a MATLAB figure "abc.fig". The size of the legend is very large and has covered the graphs. I want to reduce its size and change its location. How can I do it? I applied the right click options but in vain.
2 Commenti
Rik
il 20 Ott 2022
This is your 70th question. By now you should be aware of the advice to attach relevant files and code. Why haven't you done that yet?
Risposte (1)
Fabio Freschi
il 20 Ott 2022
You can try playing with the 'location' optional input, for example using
legend('blabla1','blabla2','Location','bestoutside')
3 Commenti
Fabio Freschi
il 20 Ott 2022
Did you play with all options for the location? For example the
clear all, close all
x=[10 15 20 25 30 35 40];
y1=[0.48 0.31 0.2 0.16 0.15 0.14 0.14];%Purple
y2=[0.46 0.21 0.13 0.08 0.07 0.06 0.06];% Orange
y3=[0.42 0.19 0.14 0.08 0.07 0.06 0.06];% Yellow
y4=[0.38 0.19 0.14 0.12 0.099 0.08 0.08];% Blue
y5=[0.3052 0.1660 0.0844 0.0629 0.0570 0.0365 0.019];% My graph
y6=[0.24 0.13 0.06 0.04 0.02 0.01 0.009];
Purple=[0.4940, 0.1840, 0.5560];
figure
semilogy(x,y1,'o-','color',Purple,'linewidth',2,'MarkerSize',7)
hold
Red=[0.8500, 0.3250, 0.0980];
semilogy(x,y2,'-','color',Red,'linewidth',2,'MarkerSize',7)
yellow=[0.9290, 0.6940, 0.1250];
semilogy(x,y3,'x-','color',yellow,'linewidth',2,'MarkerSize',9)
blue=[0.3010, 0.7450, 0.9330];
semilogy(x,y4,'v-','color',blue,'linewidth',2,'MarkerSize',7)
semilogy(x,y5,'g','linewidth',2);
semilogy(x,y6,'k--','linewidth',2);
xlabel('Signal to Noise Ratio')
ylabel('Root Mean Sqaure Error (RMSE)')
title('RMSE vs SNR with N=10')
grid on
lgd = legend('Separate Learning Methodology based','First Principle based Method','Orthogonal Moving Machine Method','Direct and Indirect Method','FPA','Clever Root based Large byproduct');
lgd.Location = 'southoutside';
You have a lot of text in your legend. You shoud try to compress the expalnations.
If you really want to keep the current text, you can try to reduce the fontsize, even I don't recommend this option for legibility.
clear all
clc
x=[10 15 20 25 30 35 40];
y1=[0.48 0.31 0.2 0.16 0.15 0.14 0.14];%Purple
y2=[0.46 0.21 0.13 0.08 0.07 0.06 0.06];% Orange
y3=[0.42 0.19 0.14 0.08 0.07 0.06 0.06];% Yellow
y4=[0.38 0.19 0.14 0.12 0.099 0.08 0.08];% Blue
y5=[0.3052 0.1660 0.0844 0.0629 0.0570 0.0365 0.019];% My graph
y6=[0.24 0.13 0.06 0.04 0.02 0.01 0.009];
Purple=[0.4940, 0.1840, 0.5560];
figure
semilogy(x,y1,'o-','color',Purple,'linewidth',2,'MarkerSize',7)
hold
Red=[0.8500, 0.3250, 0.0980];
semilogy(x,y2,'-','color',Red,'linewidth',2,'MarkerSize',7)
yellow=[0.9290, 0.6940, 0.1250];
semilogy(x,y3,'x-','color',yellow,'linewidth',2,'MarkerSize',9)
blue=[0.3010, 0.7450, 0.9330];
semilogy(x,y4,'v-','color',blue,'linewidth',2,'MarkerSize',7)
semilogy(x,y5,'g','linewidth',2);
semilogy(x,y6,'k--','linewidth',2);
xlabel('Signal to Noise Ratio')
ylabel('Root Mean Sqaure Error (RMSE)')
title('RMSE vs SNR with N=10')
grid on
lgd = legend('Separate Learning Methodology based','First Principle based Method','Orthogonal Moving Machine Method','Direct and Indirect Method','FPA','Clever Root based Large byproduct');
lgd.FontSize = 7;
Vedere anche
Categorie
Scopri di più su Legend in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!