How to reduce the size of legend in a fig file?

7 views (last 30 days)
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.
Sadiq Akbar
Sadiq Akbar on 20 Oct 2022
Thanks for your kind response dear Rik. The file is attached herewith.And the code is given below:
clear 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];
Current plot held
Red=[0.8500, 0.3250, 0.0980];
yellow=[0.9290, 0.6940, 0.1250];
blue=[0.3010, 0.7450, 0.9330];
Unrecognized function or variable 'CRLB'.
xlabel('Signal to Noise Ratio')
ylabel('Root Mean Sqaure Error (RMSE)')
title('RMSE vs SNR with N=10')
grid on
legend('Separate Learning Methodology based','First Principle based Method','Orthogonal Moving Machine Method','Direct and Indirect Method','FPA','Clever Root based Large byproduct')

Sign in to comment.

Answers (1)

Fabio Freschi
Fabio Freschi on 20 Oct 2022
You can try playing with the 'location' optional input, for example using
Many options are available (check out this link)
Sadiq Akbar
Sadiq Akbar on 20 Oct 2022
Thank you very much dear Fabio Freschi for your guiadance. Yes you are right that decreasing the font size seems bad. Your above code is very good. But since I reduce the size of the figure, so with that the legend area becomes large abd covers the graphs. With your code, the legend goes down and its very good but since I reduce the size of theb figure window so it seems very strnage to me.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!