Borrar filtros
Borrar filtros

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

6 visualizaciones (últimos 30 días)
Harr
Harr el 3 de Sept. de 2022
Comentada: Star Strider el 3 de Sept. de 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).

Respuesta aceptada

Star Strider
Star Strider el 3 de Sept. de 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
.

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by