Plotting/Scatter of m-by-n matrix versus time

20 ビュー (過去 30 日間)
Shane Thirkell
Shane Thirkell 2021 年 6 月 18 日
回答済み: Sulaymon Eshkabilov 2021 年 6 月 18 日
Hello all,
I have a set of data that is binned into 12 timestamps. That is to say, a matrix of 154x12, that I would like to (and have) plotted over my 12 timestamps. Currently I'm simply using the 'o' markers and omitting lines between points to "mimic" a scatter plot. Scatter returns an error, as it wants my data to be 1x12. I could use a loop, but this data set will continue to grow larger and it will be cumbersome. Wondering if there may be another way to present this data as I have, but with the scatter command or something similar.
At the end of the day, I want to use "hold on" and plot to distinct (but identical in size) data sets with each other on the same plot with different colors, which I've done, but the nature of the plot command doesn't allow me to label them in the legend easily - it treats each m rows of the n data points as a separate legend object. The below link is the only other community question I've seen posted similar to this topic.
Thanks all!

回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 6 月 18 日
It should work if you write your code, e.g.:
t=1:12;
G = randi([0, 13], 154, 12);
plot(t, G, 'o--'), shg

カテゴリ

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