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.
댓글 수: 0
채택된 답변
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
댓글 수: 0
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!