필터 지우기
필터 지우기

This has bugged me for ages...How to stop MATLAB writing/drawing outside the plot area (I've tried past suggestions but no luck!!)

조회 수: 8 (최근 30일)
I have the plot attached. You can see on the right side text goes outside the box area and the scattered data at the top and bottom also does the same because of their size.
I simply want the text and part of the scatter points that are outside of the box to be blanked out.
I've tried the set(h,'Clipping','on') option with no luck, and I do not want to simply change my y and x ranges leaving blank space.
Any suggestions how I can do this???
Basic code:
contourf(x,y,z,40,'LineStyle','none')
hold on
h1 = scatter(X,Y,23,'K','Square','Clipping','on')
h2 = scatter(X,Y,20,Z,'Square')
h3 = contour(x,y,z,[13.4 13.6 13.7 14],'k','ShowText','on')
  댓글 수: 3
Michael
Michael 2016년 10월 13일
편집: Michael 2016년 10월 13일
MATLAB still accepted it with no error. I noticed before but it made no difference adding the 'g'. I've edited the post to add the 'g'.
Henry Giddens
Henry Giddens 2016년 10월 13일
I dont know the answer to this (sorry), but clipping does not hide markers:
Hopefully someone can provide a solution, I am also interested to know if it can be done.

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

채택된 답변

José-Luis
José-Luis 2016년 10월 13일
편집: José-Luis 2016년 10월 13일
Workaround: you can hide it behind another axes object.
f = figure;
aH = axes;
plot(rand(10,1))
text(9,0.5,'Cut me pretty please');
aHPos = aH.Position;
widthDummy = 0.1;
dummyPos = [aHPos(1)+aHPos(3), aHPos(2), widthDummy, aHPos(4)];
dummyAH = axes('Position', dummyPos,'Color',f.Color, 'XColor',f.Color,...
'YColor', f.Color,'XTick',[], 'YTick', []);
  댓글 수: 4

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

추가 답변 (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