How to reduce space between ylabel and y ticks in Matlab plot?
44 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
How to reduce the space between y-label and y-ticks, in other words how to closer the y-label to y-axis.
0 commentaires
Réponse acceptée
Subhodh Sharma
le 25 Sep 2021
Modifié(e) : Subhodh Sharma
le 25 Sep 2021
You can use the below command..
ylh=ylabel('ylabel'); % adding ylabelto figure
dy=0.2;
ylh.Position(1)=ylh.Position(1)-dy; % you can change 'dy' according to your need. dy=+ve, will move the label from y axis. dy=-ve , will move the label closer to the axis.
3 commentaires
Walter Roberson
le 26 Sep 2021
Are you using R2015a or earlier? That would be important information to know for the purposes of this question !!
Plus de réponses (1)
yanqi liu
le 26 Sep 2021
Modifié(e) : Walter Roberson
le 26 Sep 2021
sir, my be you can ref the follow code, please check
clc; clear all; close all;
figure;
ezplot('y=sin(x)');
pause(0.1);
hs = get(gca, 'XLabel');
pos = get(hs, 'Position');
pos(2) = pos(2)+0.2;
set(hs, 'Position', pos)
hs = get(gca, 'YLabel');
pos = get(hs, 'Position');
pos(1) = pos(1)+0.2;
set(hs, 'Position', pos)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/749834/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/749839/image.png)
4 commentaires
Voir également
Catégories
En savoir plus sur Interactive Control and Callbacks 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!