Plotting Data Points with Lines to Indicate Unchanging Conditions Over Time

2 vues (au cours des 30 derniers jours)
I wish to plot a time series for some data that has horizontal/vertical lines connecting them to indicate that once a value was selected, it remains constant over time until the next point is selected. I thought of one way to do this, but it is extremely complicated and would take way more time than it's worth to implement. Does anyone know of a simple method to do this or maybe a Matlab plotting function that can do this?
Visual Example:
Left side: Data plotted Right side: Data plotted with connecting lines

Réponse acceptée

William Rose
William Rose le 22 Fév 2023
stairs(x,y)
I use it for heart rate data all the time, since, once you have a rate estimate from detecting the second R wave in a recording, you do not have another HR estimate until the next R wave is observed.
  4 commentaires
Steven Lord
Steven Lord le 22 Fév 2023
FYI, since I think a lot of users don't know about this, take a look at the Plots tab of the toolstrip. It shows small thumbnails of many of the different visualization functions in MathWorks products. If one looks similar to what you want you can see the name of the function used to create that type of plot under the thumbnail.
If you have selected a particular variable in the Workspace window you can even limit the plots shown to only those that can be created from that data and can click on the thumbnail to create a plot for that specific data.
William Rose
William Rose le 22 Fév 2023
I didn't know about that. Thank you @Steven Lord.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

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

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by