Removing extra white space on figure

Is there a way to get rid of the extra space below the spectrum so that it starts at 0? This seems to only occur for some of the figures I plot.

 Réponse acceptée

When plotting, you can set after the plot command, the following:
ylim([0 valuethatyouwant])

5 commentaires

Elham
Elham le 26 Juil 2022
Modifié(e) : Elham le 26 Juil 2022
I set
xlim([0 2048])
ylim([0 399999])
and when I hit RUN, the plots look fine, they start at 0. But for some reason when I combine multiple spectrum by copying and pasting them on top of eachother, the space shows up. Is there a way to change it without changing the code?
Francesco Pignatelli
Francesco Pignatelli le 26 Juil 2022
Can you post your code here?
%%Plot the area
b=(cell2mat(z));
maxz = find(max(b) == b);
figure('Name','Area')
hold on
plot(A(maxz*2048+1:(maxz+1)*2048),'LineWidth',1.5)
xlabel('Photon Energy(eV)','FontSize',11, 'FontWeight','bold')
ylabel('Harmonic Intensity(a.u.)','FontSize',11, 'FontWeight','bold')
title('Harmonic Intensity Using Ar','FontSize',12, 'FontWeight','bold')
set(gca,'FontWeight','bold','FontSize',10,'Color','white');
set(gca,'XTick',[])
hold off
xlim([0 2048])
ylim([0 399999])
Elham
Elham le 26 Juil 2022
Just changed the axes properties and it seems to be working fine now, thank you @Francesco Pignatelli !!
Francesco Pignatelli
Francesco Pignatelli le 26 Juil 2022
Glad to hear it! My pleasure :)

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by