How to add small circles at the end of each line?
5 次查看(过去 30 天)
显示 更早的评论
% 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).
0 个评论
采纳的回答
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
.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!