How to reduce space between ylabel and y ticks in Matlab plot?

조회 수: 87 (최근 30일)
Ammy
Ammy 2021년 9월 25일
댓글: Ammy 2021년 9월 27일
How to reduce the space between y-label and y-ticks, in other words how to closer the y-label to y-axis.

채택된 답변

Subhodh Sharma
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
Walter Roberson 2021년 9월 26일
Are you using R2015a or earlier? That would be important information to know for the purposes of this question !!
Ammy
Ammy 2021년 9월 26일
I'm using R2013a

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

yanqi liu
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)
  댓글 수: 4
yanqi liu
yanqi liu 2021년 9월 27일
Yes, sir, this is good idea
Ammy
Ammy 2021년 9월 27일
Thank you very much, but its work for ezplot,
I want to do it for plot(x,y,..)
How can I use above for that?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

제품


릴리스

R2013a

Community Treasure Hunt

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

Start Hunting!

Translated by