Add average temperature line onto plot
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
The following code is used to plot a t2m plot and i want to add a horizontal average temperature line but not sure how
any ideas?
% combined_ERA_data_new
%% Load in the data
data_1 = load('../data/ERA/ERA5_2_1979_1984.mat', 'data_to_save');
data_2 = load('../data/ERA/ERA5_2_1985_1990.mat', 'data_to_save');
data_3 = load('../data/ERA/ERA5_2_1991_2000.mat', 'data_to_save');
data_4 = load('../data/ERA/ERA5_2_2001_2010.mat', 'data_to_save');
data_5 = load('../data/ERA/ERA5_2_2011_2021.mat', 'data_to_save');
%% Combine data all
data_all = [data_1.data_to_save; data_2.data_to_save; data_3.data_to_save; data_4.data_to_save; data_5.data_to_save;];
%% Plot figure
disp('Plotting and saving a figure...');
% Make a figure
figure('units','normalized','outerposition',[0 0 1 1],'visible','on');
set(gcf,'color','w');
% Set axis font size
font_size = 12;
set(0, 'DefaultAxesFontSize', font_size);
% Plot
plot(data_all(:,1), data_all(:,2), '-r'); datetick('x')
%% Set plot details
ylabel ('T2M (degrees celcius)');
xlabel ('Time (years)');
title ('Reanalysis Dataset for T2M Data from 80.5N, to -58W, 1979-2021');
legend({'= T2M'},'Location','southwest');
ax = gca;
ax.FontSize = 14;
0 commentaires
Réponses (1)
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!