How to reduce space between ylabel and y ticks in Matlab plot?
37 次查看(过去 30 天)
显示 更早的评论
How to reduce the space between y-label and y-ticks, in other words how to closer the y-label to y-axis.
0 个评论
采纳的回答
Subhodh Sharma
2021-9-25
编辑:Subhodh Sharma
2021-9-25
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 个评论
Walter Roberson
2021-9-26
Are you using R2015a or earlier? That would be important information to know for the purposes of this question !!
更多回答(1 个)
yanqi liu
2021-9-26
编辑:Walter Roberson
2021-9-26
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)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!