Plot in months not years (setting xaxis limits)
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
Does anyone know how I can change the datenum to plot selected months rather than the whole dataset in years? e.g. I am just wanting to looking the data from 1998-2000
Attached is what my plot looks like already, the data and below are my 2 scripts. Any suggestions would be appreicated, thanks.
function data=load_CH_data(filename)
% function to load tide data from Giovanni
% input is the filename of the data file
% output is the date/time and SST from the data file
% tmp=tempory l=line
data.filename=filename;
fid=fopen(filename);
%Skips headerlines
for I=1:10
tmpl=fgetl(fid);
end
J=1;
while ischar(tmpl)
%5 strings
tmp=textscan(tmpl,'%s %f','Delimiter',',');
%data.t(J)=datenum( cell2mat(tmp{1}),'yyyy/mm/dd HH:MM:SS');
data.t(J)=datenum( cell2mat(tmp{1}) )
data.CH(J)=tmp{2};
tmpl=fgetl(fid);
J=J+1;
end
data.CH(data.CH==-32767) = NaN;
fclose(fid);
function plot_CH_data(data)
% function to plot the Giovanni data imported with load_giovanni_data
%subplot (2,1,2)
%clf
plot(data.t,data.CH,'.c-','Markersize',15,'Linewidth', 1.4)
% t_start = datenum(1998,01,08);
% t_end = datenum(2000,12,31);
datetick('x')
ylabel('Chlorophyll (mg m^-^3)', 'fontsize', 18)
%ylabel('Plankton (mg m^-^3)', 'fontsize', 18)
xlabel('Year', 'fontsize', 18)
legend ('Chlorophyll 1997-2006')%,'Zooplankton 1995', 'Zooplankton 1996','Zooplankton 1997','Zooplankton 1998','Zooplankton 1999','Zooplankton 2000','Zooplankton 2001','Zooplankton 2002', 'Zooplankton 2003', 'Zooplankton 2004', 'Zooplankton 2005', 'Zooplankton 2006')
%title('-4.9438,50.647,-4.7351,50.9436, 2002-2012 SST', 'fontsize', 14)
end
Antworten (1)
KALYAN ACHARJYA
am 3 Jan. 2020
0 Stimmen
1 Kommentar
Miriam Daughtery
am 3 Jan. 2020
Diese Frage ist geschlossen.
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!