Plotting Data Points with Lines to Indicate Unchanging Conditions Over Time

4 visualizaciones (últimos 30 días)
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

Respuesta aceptada

William Rose
William Rose el 22 de Feb. de 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 comentarios
Steven Lord
Steven Lord el 22 de Feb. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by