필터 지우기
필터 지우기

How to plot a plot that has multi coordinates in one x coordinate?

조회 수: 2 (최근 30일)
juan sanchez
juan sanchez 2021년 10월 6일
댓글: juan sanchez 2021년 11월 5일
How to plot a plot that has multi coordinates in one x coordinate? Please see attached image.

채택된 답변

Dave B
Dave B 2021년 11월 4일
편집: Dave B 2021년 11월 4일
A good strategy for these kinds of plots is to treat it as if the numbers are 1 to 15, and then just change the labels
y=rand(1,15);
x=1:15;
scatter(x,y,'x')
set(gca,'XTick',1:15,'XTickLabels',1:3)
for i = 1:5
xline(i*3+.5,'Label',"ZONE " + i, 'LabelHorizontalAlignment', 'left')
end
box on
But you can also use tiledlayout effectively for this kind of thing by setting the TileSpacing property to 'none'
figure
t=tiledlayout(1,5,'TileSpacing','none');
for i = 1:5
scatter(nexttile,1:3,rand(1,3),'x')
ylabel("ZONE " + i) % you might want to use the text function for the labels...as this is awkward
box on
end
linkaxes(t.Children)
xlim([.5 3.5])
set(t.Children(1:4), 'YTickLabel', [])
xlabel(t,'Case Number')
  댓글 수: 1
juan sanchez
juan sanchez 2021년 11월 5일
Thank you very much, this was a very good plot and identical to the question.

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

추가 답변 (0개)

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by