how can i put a horizental bar on a plot?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
furkan akhan
le 31 Mai 2021
Réponse apportée : Star Strider
le 31 Mai 2021
I have starting and ending indexes. I atteched these indexes in that files. I also have a plot. I want to put a horizental bar between vertical lines. Can you help me? It is my code
Sound=structWheeze(1,1).SoundData;
starting=structWheeze(1,1).Properties.WS_new;
ending=structWheeze(1,1).Properties.WE_new;
x = linspace(0, 144000 , 144000);
figure
plot(x,Sound)
hold on
plot(x(starting[1 1]).',(ones(size(starting,1),2).ylim).', 'g', 'LineWidth',2); %green markers
plot(x(ending[1 1]).', (ones(size(ending,1),2).ylim).', 'r', 'LineWidth',2); %red markers
hold off
grid
0 commentaires
Réponse acceptée
Star Strider
le 31 Mai 2021
We do not have the plot of the signal, however drawing the horizontal lines between the starting green lines and the ending red lines is straightforward.
WS_new_array = [1063; 17565; 21359; 36899; 55411; 70245; 90088; 102232; 114892; 119569; 123811];
WE_new_array = [7952; 19385; 26744; 45315; 61905; 77760; 94105; 111387; 117453; 122765; 126968];
figure
plot((WS_new_array*[1 1]).', (ones(size(WS_new_array))*ylim).', 'g')
hold on
plot((WE_new_array*[1 1]).', (ones(size(WE_new_array))*ylim).', 'r')
plot([WS_new_array WE_new_array], [1 1]*0.8, '-k', 'LineWidth',2)
hold off
grid
I plotted them at a y-value of 0.8 here, as solid balck lines with a line width of 2. Change those to whatever value you want.
.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!