Surf plot and colorbar are overlapping

Hello,
My surface plot and colorbar overlap each other and I am not sure how to move it over alittle. here is my code:
s1 =surf(squeeze(Strain_energy_Data_extract(:,1:1,:)),squeeze(Strain_energy_Data_extract(:,2:2,:)),squeeze(Strain_energy_Data_extract(:,3:3,:)));
%Setting a white background and clean font
set(0,'DefaultFigureColor','White','defaultaxesfontsize',8,'DefaultAxesFontname','Calibri','DefaultTextFontName','Calibri')
colormap('jet');
c = colorbar('FontSize',9);
c.Label.String = 'p';
%Setting the axes label, type, position, rotation, etc.
xlabel('m', 'FontSize', 11,'fontweight', 'bold')
ylabel('m', 'FontSize', 11,'fontweight', 'bold')
ztickformat("%.3f")
yticks(-0.02:0.010:0.02)
xticks(-0.02:0.020:0.02)
set(gca,'FontSize',11,'FontWeight','Bold')
view([32.2969 -28.3125])
yh = get(gca,'yLabel'); % Handle of the y label
set(yh, 'Units', 'Normalized')
pos = get(yh, 'Position');
set(yh, 'Position',pos.*[0.85,0.6,1],'Rotation',-10.9)
xh = get(gca,'xLabel'); % Handle of the x label
set(xh, 'Units', 'Normalized')
pos = get(xh, 'Position');
set(xh, 'Position',pos.*[1,1,1],'Rotation',15)
zh = get(gca,'zLabel'); % Handle of the z label
set(zh, 'Units', 'Normalized')
pos = get(zh, 'Position');
set(zh, 'Position',pos.*[1.5,1,0],'Rotation',90)
%Enhancing the surface characteristics
grid on;grid minor
axis tight
camlight
lighting phong
shading interp
set(s1,'edgecolor',[0 0 0.4],'meshstyle','both','linewidth',.15);
I am adding my plot image here also

Antworten (1)

Jonas
Jonas am 2 Mai 2022

0 Stimmen

your colorbar c has also a Position property, read it once to get an idea if the current magnitude of numbers and change it in such a way, that it is located more right.
Alternatively, use the Property Inspector to move the colorbar and copy the values of the Position property when you are happy with the appearance

Kategorien

Mehr zu Color and Styling finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

am 1 Mai 2022

Beantwortet:

am 2 Mai 2022

Community Treasure Hunt

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

Start Hunting!

Translated by