Change marker types on a time series plot

6 次查看(过去 30 天)
I have this time series graph and I want to change the markers from dots to vertical lines originating from (x,0). This is the code I used to create the timeseries and plot it.
GAUGE_ts = timeseries(RNFLG,Dates);
SAT_ts = timeseries(SAT_RNFL,Dates);
GAUGE_ts2 = timeseries(RNFLG2,Dates2);
figure %Time series plot
plot(GAUGE_ts,'.','markers',12)
hold on
plot(SAT_ts,'.','markers',12)
plot(GAUGE_ts2,'.','markers',12)
When i change the marker symbol from '.' to '-', I get a line connecting all the pints.

采纳的回答

Steven Lord
Steven Lord 2018-10-30
If you're using a release that supports timetable I recommend storing your data in a timetable instead of a timeseries.
MeasurementTime = datetime({'2015-12-18 08:03:05';'2015-12-18 10:03:17';'2015-12-18 12:03:13'});
Temp = [37.3;39.1;42.3];
Pressure = [30.1;30.03;29.9];
WindSpeed = [13.4;6.5;7.3];
WindDirection = categorical({'NW';'N';'NW'});
TT = timetable(MeasurementTime,Temp,Pressure,WindSpeed,WindDirection);
To create the type of plot you described using TT:
stem(TT.MeasurementTime, TT.WindSpeed)
With larger markers:
stem(TT.MeasurementTime, TT.WindSpeed, 'MarkerSize', 12)
With filled larger markers in different colors:
stem(TT.MeasurementTime, TT.WindSpeed, 'filled', 'MarkerSize', 12)
With filled larger markers in different colors based on the temperature:
stem(TT.MeasurementTime, TT.WindSpeed, 'MarkerSize', 12)
hold on
scatter(TT.MeasurementTime, TT.WindSpeed, 144, TT.Temp, 'filled')
colorbar

更多回答(1 个)

Brandon Bush
Brandon Bush 2018-10-30
编辑:Brandon Bush 2018-10-30
I actually figured it out by removing the time series and using the normal bar function. i will actually try this the next time i have a chance, thanks for your feedback.

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by