필터 지우기
필터 지우기

how to adjust date limite on the x axis label

조회 수: 1 (최근 30일)
PIA ASSI
PIA ASSI 2021년 3월 5일
답변: Nagasai Bharat 2021년 3월 8일
[num, txt,tab] = xlsread('test.xls');
[r,c] = size(num);
DATES= txt(2:r+1,1);
datesnum= datenum(DATES, 'mm/dd/yyyy');
date1= txt(2,1);
date2= txt(end,1);
for x=1:c
asset= txt(1,x+1);
p=plot(datesnum, num(:,x),'Color','k');
%xlim manual
p.LineWidth = 1.5
t1= datesnum(1)
t2= datesnum (30)
%xlim([t1,t2])
datetick ('x','mm/dd/yyyy');
xlabel('Dates','FontSize',14,'FontWeight','bold');
ylabel('Prix','FontSize',14,'FontWeight','bold');
charasset= char(asset);
titletext=['cours de l''action',' ', charasset,' ','entre',' ',char(date1),' ','et',' ', char(date2)];
title(titletext);
savefig(charasset);
print(charasset,'-dpng');
end
  댓글 수: 1
PIA ASSI
PIA ASSI 2021년 3월 5일
the data range label is larger than the data itself. how can i adjust it?

댓글을 달려면 로그인하십시오.

답변 (1개)

Nagasai Bharat
Nagasai Bharat 2021년 3월 8일
Hi,
From my understanding you are trying to plot in the range to data the is being plotted rather than the range label you are providing. Use the follwing MATLAB command after the plot command
plot(x,y);
axis tight
The axis should provide you with more detailed information.

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by