How to add legends to a subplot and how to set the YTick?

조회 수: 1 (최근 30일)
Szabó-Takács Beáta
Szabó-Takács Beáta 2018년 11월 20일
댓글: Szabó-Takács Beáta 2018년 11월 20일
Dear All,
I tried to create a subplot with the following code by Matlab R2015b:
I attached the resulted plot. I do not understand why the two legends have a same mark? Moreover, I do not understand why the YTick is not setted based on the y values? Can someone suggest a solution to fix these issues?
y=[0:100:800];
N=[0:8];
subplot(2,4,1);
scatter(N,winter2(:,2),'Fill');
legend('10°<h<20°')
hold on
scatter(N,winter2(:,3),'Fill', 'DisplayName', '20°<h<30°');
legend('off');
legend('show');
set(gca,'XTick',N);
ylabel('Wm^-^2', 'FontSize',12, 'FontWeight', 'bold')
xlabel('N', 'FontSize',12, 'FontWeight', 'bold')
set(gca,'YTick', y)
title('D,J,F', 'FontSize',12, 'FontWeight', 'bold')
  댓글 수: 3
Jan
Jan 2018년 11월 20일
What exactly is the problem? Which legends have which "same marks"? You do not set the YTicks anywhere. Maybe there was an axes at the position of the subplot already?
Szabó-Takács Beáta
Szabó-Takács Beáta 2018년 11월 20일
This was a bug in R2015b. Moreover I figured out that I can set the YTicks in 'Figure Properties' window.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

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

제품


릴리스

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by