Borrar filtros
Borrar filtros

Is it possible to make larger gap between xlabel and the x-axes?

119 visualizaciones (últimos 30 días)
Mr M.
Mr M. el 29 de Mayo de 2015
Comentada: Enrico Maria Turco el 27 de Dic. de 2020
How to set the gap/space between x or y legends and axes?

Respuestas (2)

Jos (10584)
Jos (10584) el 29 de Mayo de 2015
Editada: Jos (10584) el 29 de Mayo de 2015
You can use SET and GET:
xh = get(gca,'xlabel') % handle to the label object
p = get(xh,'position') % get the current position property
p(2) = 2*p(2) ; % double the distance,
% negative values put the label below the axis
set(xh,'position',p) % set the new position
  3 comentarios
Jos (10584)
Jos (10584) el 6 de Jun. de 2015
Editada: Jos (10584) el 6 de Jun. de 2015
Try another value than 2, like p(2) = 1.1 * p(2)
Lars Abrahamsson
Lars Abrahamsson el 28 de Sept. de 2020
Even very small movement might go out of the picture:
clear all
close all
TestX = randn(1,10);
TestY = randn(1,10);
X = cumsum(TestX);
Y = cumsum(TestY);
figure
plot(X,Y)
xlabel('balle')
ylabel('bolle')
figure
plot(X,Y)
xlabel('balle')
ylabel('bolle')
xh = get(gca,'xlabel') % handle to the label object
p = get(xh,'position') % get the current position property
p(2) = - 0.1 + p(2) ; % double the distance,
% negative values put the label below the axis
set(xh,'position',p) % set the new position
For example.
Is there nothing that can be doune against it?

Iniciar sesión para comentar.


Tongyao Pu
Tongyao Pu el 23 de Nov. de 2019
Maybe it is too late for your problem, but another way could be just adding an extra blank line:
title({'the title you want to add',' '})
  2 comentarios
BN
BN el 1 de Abr. de 2020
What if I want to increase the gap between ylabel and the y-axes?
Enrico Maria Turco
Enrico Maria Turco el 27 de Dic. de 2020
yl=get(gca,'ylabel');
pyl = get(yl,'position');
pyl(1) = 1.05*pyl(1);
set(yl,'position',pyl)
Note that a minor change of 0.05 might be sufficient to have enough space.

Iniciar sesión para comentar.

Categorías

Más información sobre Labels and Annotations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by