How to insert bar markers in a line plot
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Aaron Ouyang
le 11 Juil 2022
Réponse apportée : Aaron Ouyang
le 12 Juil 2022
Hi,
I've been plotting a line graph of a cell's response to different chemicals administered at different times. The dataset is a 1470x1 double. I ran this code to generate a graph:
load(data)
t = linspace(0,length(data)*2, length(data)); % create a vector specifying the data to use for the x axis. i need to adjust the axis because the data was collected in a different timeframe
plot(t, data);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1062200/image.png)
I want to be able to show the names of the compounds injected with text labels and I also want to have bars underneath the line plot that indicate when a stimulus was injected and for how long (i.e. at 1500 seconds Compound 8 was injected for 20 seconds). I drew a picture to illustrate my idea:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1063285/image.png)
Does anyone know how I can make this happen? Thank you.
Réponse acceptée
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!