필터 지우기
필터 지우기

How to add small circles at the end of each line?

조회 수: 6 (최근 30일)
Harr
Harr 2022년 9월 3일
댓글: Star Strider 2022년 9월 3일
% I have the following simplified table named "data"
% In a loop i extract each type of H in the first column (below is an example of H19)
%data=
% col_1 col_2 col_3 col_4 col_5 col_6 col_7
% H19 160 163 6.18e-06 TFa: H0 Fler
% H19 148 150 1.55e-05 TFa: H0 Fler
% H19 100 102 4.02e-05 TFa: H0 Fler
% H19 170 182.5 0.000275 TFa: H0 Fler
% Getting x1, y1 and y2 which are coordinated for the start and end of small lines
x1 = data.col_4;
y1 = data.col_2;
y2 = data.col_3;
% Then I have ploted all small lines in the following loop:
for i = 1:length(x1)
8 = plot([x1(i,1),x1(i,1)],[y1(i,1),y2(i,1)],'LineWidth',2,'color',[0 0 0]);
end
% How to add small circles at the end of each line? as shown near the question mark in the figure below! but for all small lines (we have four lines in this example).

채택된 답변

Star Strider
Star Strider 2022년 9월 3일
Try this —
data = { 'col_1' 'col_2' 'col_3' 'col_4' 'col_5' 'col_6' 'col_7'
'H19' 160 163 6.18e-06 'TFa:' 'H0' 'Fler'
'H19' 148 150 1.55e-05 'TFa:' 'H0' 'Fler'
'H19' 100 102 4.02e-05 'TFa:' 'H0' 'Fler'
'H19' 170 182.5 0.000275 'TFa:' 'H0' 'Fler'};
x1 = [data{2:end,4}];
y1 = [data{2:end,2}];
y2 = [data{2:end,3}];
figure
hold on
for i = 1:length(x1)
h{i} = plot([x1(i),x1(i)],[y1(i),y2(i)],'o-','LineWidth',2,'Color',[0 0 0]);
end
hold off
grid
.
  댓글 수: 2
Harr
Harr 2022년 9월 3일
Thanks alot Star Strider ^_^
Star Strider
Star Strider 2022년 9월 3일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by