how to adjust date limite on the x axis label

1 view (last 30 days)
[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 Comment
PIA ASSI
PIA ASSI on 5 Mar 2021
the data range label is larger than the data itself. how can i adjust it?

Sign in to comment.

Answers (1)

Nagasai Bharat
Nagasai Bharat on 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.

Categories

Find more on Printing and Saving in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!