Plotting Data Points with Lines to Indicate Unchanging Conditions Over Time

3 次查看(过去 30 天)
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

采纳的回答

William Rose
William Rose 2023-2-22
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 个评论
Steven Lord
Steven Lord 2023-2-22
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Scatter Plots 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by