Plot in months not years (setting xaxis limits)
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
KALYAN ACHARJYA
2020년 1월 3일
0 개 추천
댓글 수: 1
Miriam Daughtery
2020년 1월 3일
이 질문은 마감되었습니다.
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!