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

3 views (last 30 days)
% 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).

Accepted Answer

Star Strider
Star Strider on 3 Sep 2022
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
.

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!