Filter löschen
Filter löschen

Change marker types on a time series plot

5 Ansichten (letzte 30 Tage)
Brandon Bush
Brandon Bush am 30 Okt. 2018
Bearbeitet: Brandon Bush am 30 Okt. 2018
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.

Akzeptierte Antwort

Steven Lord
Steven Lord am 30 Okt. 2018
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

Weitere Antworten (1)

Brandon Bush
Brandon Bush am 30 Okt. 2018
Bearbeitet: Brandon Bush am 30 Okt. 2018
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.

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by