Change marker types on a time series plot

6 ビュー (過去 30 日間)
Brandon Bush
Brandon Bush 2018 年 10 月 30 日
編集済み: Brandon Bush 2018 年 10 月 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 Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by