Leged for multiple subplots

1 view (last 30 days)
I have a figure that includes three subplot. I'd like to add an overall legent to the figure at the location of the fourth subplot (which is empty). I have already read this post, but I think it does not answer my question. Would you please help me to figure out how I can do it?
My code is as follows (you don't have some of its data):
subplot(2,2,1);
plot(2615, 50, 's', 'MarkerEdgeColor', [0 0.4470 0.7410], 'MarkerFaceColor', [0 0.4470 0.7410], 'MarkerSize', 7)
hold on
plot(fg1(1,:), fg1(2,:), 'o', 'MarkerEdgeColor', [0.8500 0.3250 0.0980], 'MarkerFaceColor', [0.8500 0.3250 0.0980], 'MarkerSize', 7)
plot([pop(fg).obj1], [pop(fg).obj2], '*', 'MarkerEdgeColor', [0.9290 0.6940 0.1250], 'MarkerSize', 7)
grid on
title('Obj. 1 vs Obj. 2')
ylabel('Obj. 2: DSM')
xlabel('Obj. 1: TCS')
subplot(2,2,2);
plot(2615, 12, 's', 'MarkerEdgeColor', [0 0.4470 0.7410], 'MarkerFaceColor', [0 0.4470 0.7410], 'MarkerSize', 7)
hold on
plot(fg1(1,:), fg1(3,:), 'o', 'MarkerEdgeColor', [0.8500 0.3250 0.0980], 'MarkerFaceColor', [0.8500 0.3250 0.0980], 'MarkerSize', 7)
plot([pop(fg).obj1], [pop(fg).obj3], '*', 'MarkerEdgeColor', [0.9290 0.6940 0.1250], 'MarkerSize', 7)
grid on
title('Obj. 1 vs Obj. 3')
ylabel('Obj. 3: DCH')
xlabel('Obj. 1: TCS')
subplot(2,2,3);
plot(50, 12, 's', 'MarkerEdgeColor', [0 0.4470 0.7410], 'MarkerFaceColor', [0 0.4470 0.7410], 'MarkerSize', 7)
hold on
plot(fg1(2,:), fg1(3,:), 'o', 'MarkerEdgeColor', [0.8500 0.3250 0.0980], 'MarkerFaceColor', [0.8500 0.3250 0.0980], 'MarkerSize', 7)
plot([pop(fg).obj2], [pop(fg).obj3], '*', 'MarkerEdgeColor', [0.9290 0.6940 0.1250], 'MarkerSize', 7)
grid on
title('Obj. 2 vs Obj. 3')
ylabel('Obj. 3: DCH')
xlabel('Obj. 2: DSM')

Accepted Answer

Star Strider
Star Strider on 18 Dec 2021
I cannot run the posted code without the included data. However this is a relatively straightforward problem.
See: Plotting different datasets from looped ode45 using subplots. for an example to adapt to the posted problem. (This is the most recent example of the three I have posted Answers to, and now can’t find the others.)
.

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!