Leged for multiple subplots

조회 수: 2 (최근 30일)
Amirhossein Moosavi
Amirhossein Moosavi 2021년 12월 18일
답변: Star Strider 2021년 12월 18일
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')

채택된 답변

Star Strider
Star Strider 2021년 12월 18일
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.)
.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by