필터 지우기
필터 지우기

Fill the patch between 2 X limits

조회 수: 1 (최근 30일)
Tiago Dias
Tiago Dias 2018년 2월 20일
댓글: Walter Roberson 2019년 2월 27일
Hello, I got Picture 1 and my goal was to create Picture 2 ideally, if not possible Picture 3. My objective is to create a legend for the red part of the plot, ideally, an arrow between the 2 limits would be awesome. Thanks
I am open to other suggestion to make a legend of that specific part. Thank you
figure
%Plot something
plot(1:10)
% Add lines
h1 = line([2 2],[1 10]);
h2 = line([5 5],[1 10]);
% Set properties of lines
set([h1 h2],'Color','k','LineWidth',2)
% Add a patch
patch([2 5 5 2],[1 1 10 10],'red')

채택된 답변

Walter Roberson
Walter Roberson 2018년 2월 20일
You could consider using annotation('doublearrow'). But watch out: the coordinates by default are normalized to the figure, so you can have to go through some steps to get them relative to the axes (and then you have to re-calculate if the axes gets resized or panned.)
  댓글 수: 2
Tiago Dias
Tiago Dias 2018년 2월 20일
yeah, I know the points where I want to draw the "arrow", but I can't get the points like I want

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

추가 답변 (1개)

Sagar Shah
Sagar Shah 2019년 2월 27일
Did you get proper answer or code for that? Currently, I need the same arrow indication as you needed.
Can you please share information?
  댓글 수: 2
Tiago Dias
Tiago Dias 2019년 2월 27일
i tried the "annotation" tool, but its normalized so i couldn't work properly so i dropped it
Walter Roberson
Walter Roberson 2019년 2월 27일
The File Exchange contribution I posted a link to converts coordinates to make it possible to use data coordinates instead of figure coordinates.

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by