Is there a setting to move labels on a plot closer
In the following image is plotted with the code:
load(‘data.mat’);
f = figure;
f.Position = [21,471,1883,333];
subplot(1,4,1);
S = 50;
scatter3(xCoord*1e6,yCoord*1e6,zCoord*1e6,S,sd1,’filled’);
xlabel(‘x (mum)’);
ylabel(‘y (mum)’);
zlabel(‘z (mum)’);
xlim([-15 15]);
ylim([-15 15]);
zlim([-15 15]);
xticks([-15 0 15]);
xticklabels({‘-15′,’0′,’15’});
yticks([-15 0 15]);
yticklabels({‘-15′,’0′,’15’});
zticks([-15 0 15]);
zticklabels({‘-15′,’0′,’15’});
% axis equal;
cb = colorbar();
% clim([0 1]);
title(cb, ‘SD1’);
subplot(1,4,2);
S = 50;
scatter3(xCoord*1e6,yCoord*1e6,zCoord*1e6,S,sd2,’filled’);
xlabel(‘x (mum)’);
ylabel(‘y (mum)’);
zlabel(‘z (mum)’);
xlim([-15 15]);
ylim([-15 15]);
zlim([-15 15]);
xticks([-15 0 15]);
xticklabels({‘-15′,’0′,’15’});
yticks([-15 0 15]);
yticklabels({‘-15′,’0′,’15’});
zticks([-15 0 15]);
zticklabels({‘-15′,’0′,’15’});
% axis equal;
cb = colorbar();
% clim([0 1]);
title(cb, ‘SD2’);
subplot(1,4,3);
S = 50;
scatter3(xCoord*1e6,yCoord*1e6,zCoord*1e6,S,sd3,’filled’);
xlabel(‘x (mum)’);
ylabel(‘y (mum)’);
zlabel(‘z (mum)’);
xlim([-15 15]);
ylim([-15 15]);
zlim([-15 15]);
xticks([-15 0 15]);
xticklabels({‘-15′,’0′,’15’});
yticks([-15 0 15]);
yticklabels({‘-15′,’0′,’15’});
zticks([-15 0 15]);
zticklabels({‘-15′,’0′,’15’});
% axis equal;
cb = colorbar();
% clim([0 1]);
title(cb, ‘SD3’);
subplot(1,4,4);
S = 50;
scatter3(xCoord*1e6,yCoord*1e6,zCoord*1e6,S,relangle,’filled’);
xlabel(‘x (mum)’);
ylabel(‘y (mum)’);
zlabel(‘z (mum)’);
xlim([-15 15]);
ylim([-15 15]);
zlim([-15 15]);
xticks([-15 0 15]);
xticklabels({‘-15′,’0′,’15’});
yticks([-15 0 15]);
yticklabels({‘-15′,’0′,’15’});
zticks([-15 0 15]);
zticklabels({‘-15′,’0′,’15’});
% axis equal;
cb = colorbar();
clim([0 30]);
title(cb, ‘alpha’);
Notice the colorbar labels "SD1", "SD2", "SD3" are clipped at the top and X and Y axes labels are far away from the axes.
Is there a setting to fix all these? I have been moving them manually with the editor but I have several of these figures and would like to make them as consistent as possible in terms of things like label positions. I think it is possible to scan the texts and set their positions semi-manually with code, but it would be much easier if there is a setting like "tight’ or something to move them closer. But "axis tight" does not work here, possibly due to the 3D nature of the plots.In the following image is plotted with the code:
load(‘data.mat’);
f = figure;
f.Position = [21,471,1883,333];
subplot(1,4,1);
S = 50;
scatter3(xCoord*1e6,yCoord*1e6,zCoord*1e6,S,sd1,’filled’);
xlabel(‘x (mum)’);
ylabel(‘y (mum)’);
zlabel(‘z (mum)’);
xlim([-15 15]);
ylim([-15 15]);
zlim([-15 15]);
xticks([-15 0 15]);
xticklabels({‘-15′,’0′,’15’});
yticks([-15 0 15]);
yticklabels({‘-15′,’0′,’15’});
zticks([-15 0 15]);
zticklabels({‘-15′,’0′,’15’});
% axis equal;
cb = colorbar();
% clim([0 1]);
title(cb, ‘SD1’);
subplot(1,4,2);
S = 50;
scatter3(xCoord*1e6,yCoord*1e6,zCoord*1e6,S,sd2,’filled’);
xlabel(‘x (mum)’);
ylabel(‘y (mum)’);
zlabel(‘z (mum)’);
xlim([-15 15]);
ylim([-15 15]);
zlim([-15 15]);
xticks([-15 0 15]);
xticklabels({‘-15′,’0′,’15’});
yticks([-15 0 15]);
yticklabels({‘-15′,’0′,’15’});
zticks([-15 0 15]);
zticklabels({‘-15′,’0′,’15’});
% axis equal;
cb = colorbar();
% clim([0 1]);
title(cb, ‘SD2’);
subplot(1,4,3);
S = 50;
scatter3(xCoord*1e6,yCoord*1e6,zCoord*1e6,S,sd3,’filled’);
xlabel(‘x (mum)’);
ylabel(‘y (mum)’);
zlabel(‘z (mum)’);
xlim([-15 15]);
ylim([-15 15]);
zlim([-15 15]);
xticks([-15 0 15]);
xticklabels({‘-15′,’0′,’15’});
yticks([-15 0 15]);
yticklabels({‘-15′,’0′,’15’});
zticks([-15 0 15]);
zticklabels({‘-15′,’0′,’15’});
% axis equal;
cb = colorbar();
% clim([0 1]);
title(cb, ‘SD3’);
subplot(1,4,4);
S = 50;
scatter3(xCoord*1e6,yCoord*1e6,zCoord*1e6,S,relangle,’filled’);
xlabel(‘x (mum)’);
ylabel(‘y (mum)’);
zlabel(‘z (mum)’);
xlim([-15 15]);
ylim([-15 15]);
zlim([-15 15]);
xticks([-15 0 15]);
xticklabels({‘-15′,’0′,’15’});
yticks([-15 0 15]);
yticklabels({‘-15′,’0′,’15’});
zticks([-15 0 15]);
zticklabels({‘-15′,’0′,’15’});
% axis equal;
cb = colorbar();
clim([0 30]);
title(cb, ‘alpha’);
Notice the colorbar labels "SD1", "SD2", "SD3" are clipped at the top and X and Y axes labels are far away from the axes.
Is there a setting to fix all these? I have been moving them manually with the editor but I have several of these figures and would like to make them as consistent as possible in terms of things like label positions. I think it is possible to scan the texts and set their positions semi-manually with code, but it would be much easier if there is a setting like "tight’ or something to move them closer. But "axis tight" does not work here, possibly due to the 3D nature of the plots. In the following image is plotted with the code:
load(‘data.mat’);
f = figure;
f.Position = [21,471,1883,333];
subplot(1,4,1);
S = 50;
scatter3(xCoord*1e6,yCoord*1e6,zCoord*1e6,S,sd1,’filled’);
xlabel(‘x (mum)’);
ylabel(‘y (mum)’);
zlabel(‘z (mum)’);
xlim([-15 15]);
ylim([-15 15]);
zlim([-15 15]);
xticks([-15 0 15]);
xticklabels({‘-15′,’0′,’15’});
yticks([-15 0 15]);
yticklabels({‘-15′,’0′,’15’});
zticks([-15 0 15]);
zticklabels({‘-15′,’0′,’15’});
% axis equal;
cb = colorbar();
% clim([0 1]);
title(cb, ‘SD1’);
subplot(1,4,2);
S = 50;
scatter3(xCoord*1e6,yCoord*1e6,zCoord*1e6,S,sd2,’filled’);
xlabel(‘x (mum)’);
ylabel(‘y (mum)’);
zlabel(‘z (mum)’);
xlim([-15 15]);
ylim([-15 15]);
zlim([-15 15]);
xticks([-15 0 15]);
xticklabels({‘-15′,’0′,’15’});
yticks([-15 0 15]);
yticklabels({‘-15′,’0′,’15’});
zticks([-15 0 15]);
zticklabels({‘-15′,’0′,’15’});
% axis equal;
cb = colorbar();
% clim([0 1]);
title(cb, ‘SD2’);
subplot(1,4,3);
S = 50;
scatter3(xCoord*1e6,yCoord*1e6,zCoord*1e6,S,sd3,’filled’);
xlabel(‘x (mum)’);
ylabel(‘y (mum)’);
zlabel(‘z (mum)’);
xlim([-15 15]);
ylim([-15 15]);
zlim([-15 15]);
xticks([-15 0 15]);
xticklabels({‘-15′,’0′,’15’});
yticks([-15 0 15]);
yticklabels({‘-15′,’0′,’15’});
zticks([-15 0 15]);
zticklabels({‘-15′,’0′,’15’});
% axis equal;
cb = colorbar();
% clim([0 1]);
title(cb, ‘SD3’);
subplot(1,4,4);
S = 50;
scatter3(xCoord*1e6,yCoord*1e6,zCoord*1e6,S,relangle,’filled’);
xlabel(‘x (mum)’);
ylabel(‘y (mum)’);
zlabel(‘z (mum)’);
xlim([-15 15]);
ylim([-15 15]);
zlim([-15 15]);
xticks([-15 0 15]);
xticklabels({‘-15′,’0′,’15’});
yticks([-15 0 15]);
yticklabels({‘-15′,’0′,’15’});
zticks([-15 0 15]);
zticklabels({‘-15′,’0′,’15’});
% axis equal;
cb = colorbar();
clim([0 30]);
title(cb, ‘alpha’);
Notice the colorbar labels "SD1", "SD2", "SD3" are clipped at the top and X and Y axes labels are far away from the axes.
Is there a setting to fix all these? I have been moving them manually with the editor but I have several of these figures and would like to make them as consistent as possible in terms of things like label positions. I think it is possible to scan the texts and set their positions semi-manually with code, but it would be much easier if there is a setting like "tight’ or something to move them closer. But "axis tight" does not work here, possibly due to the 3D nature of the plots. plotting, text, position MATLAB Answers — New Questions