Effacer les filtres
Effacer les filtres

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

6 vues (au cours des 30 derniers jours)
Harr
Harr le 3 Sep 2022
Commenté : Star Strider le 3 Sep 2022
% 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).

Réponse acceptée

Star Strider
Star Strider le 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
.
  2 commentaires
Harr
Harr le 3 Sep 2022
Thanks alot Star Strider ^_^
Star Strider
Star Strider le 3 Sep 2022
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by