how to adjust date limite on the x axis label

1 vue (au cours des 30 derniers jours)
PIA ASSI
PIA ASSI le 5 Mar 2021
[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 commentaire
PIA ASSI
PIA ASSI le 5 Mar 2021
the data range label is larger than the data itself. how can i adjust it?

Connectez-vous pour commenter.

Réponses (1)

Nagasai Bharat
Nagasai Bharat le 8 Mar 2021
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.

Catégories

En savoir plus sur Printing and Saving 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!

Translated by