How to create a scatter plot with multiple data
4 ビュー (過去 30 日間)
回答 (1 件)
Karim 2022 年 11 月 28 日
Hello, see below for a demonstation on how to make the scatter plot.
Note that it uses a 'crude' way to define the dates, probably you have more detailed information about the dates, it's better to use that. The main idea is to first define the dates as a string array. And the convert those strings into datetime's. Matlab is able to directly use datetimes in the figures.
% create a list of the months
Months = ["1" "2" "3"]; % make a string array of the months of intres (i.e. Jan, Feb and March)
Months = datetime(Months,'InputFormat','MM','Format','yyyy-MM') % convert to datetimes
% list the amount of snow per month
Snow = [8.84 5.15 3.85];
% create a scatter plot
% label the y-axis
% Set the ticks in the figure to month information
ax = gca;
ax.XTick = Months;