How to make it so the matlab surf plot is not overlapping my axes

조회 수: 4 (최근 30일)
Leo Quintanar
Leo Quintanar 2018년 1월 24일
댓글: Walter Roberson 2018년 1월 24일
Hello I seem to have a big problem, I have a colorbar overlapping my axes and I am not sure how to move it over alittle. here is my code:
s2 = surf(EnergyAlpha, TimeDelayAlpha, AbsorbanceChangeAlpha); % Creates a surfurace of the values in the postive quadraunt of the x,y,z
hold
s1 = surf(EnergyBeta, TimeDelayBeta, AbsorbanceChangeBeta); % Creates a surfurace of the values in the negativ quadraunt of the x,y,z
% Use this for WS2image and PerovskiteImage
xlim([1.8 2.7]); % Limist the x axis
ylim([-1.4 100]); % Limist the y axis
zlim([-3.7 4.3]); % Limist the z axis
% Use this for WS2-Perovskite-image
%xlim([1.8 2.7]); % Limist the x axis
%ylim([-1.4 100]); % Limist the y axis
%zlim([-2 5.8]); % Limist the z axis
c = colorbar;
c.Location = 'eastoutside';
c.Position(4) = 5;
az = 220;
el = 30;
view(az, el);
%title(fileName, 'fontsize',25) % Title label
%xlabel('Photon Energy (eV)', 'fontsize',20) % x-axis label
%ylabel('Time-Delay (ps)', 'fontsize',20) % y-axis label
%zlabel('Absorbance Change', 'fontsize',20) % z-axis label
set(gca,'linewidth', 2,'fontsize',40) % Sets the width of the axis lines
here's a picture of my surface graph:

답변 (1개)

Walter Roberson
Walter Roberson 2018년 1월 24일
  댓글 수: 2
Leo Quintanar
Leo Quintanar 2018년 1월 24일
I tried
colorbar('eastoutside')
and it still overlaps the zero, I tried colorbar('manual') but I am not sure how to manipulate the position property.
Walter Roberson
Walter Roberson 2018년 1월 24일
colorbar('Position', [....])
"Custom location and size, specified as a four-element vector of the form [left, bottom, width, height]. The left and bottom elements specify the distance from the lower-left corner of the figure or to the lower-left corner of the colorbar. The width and height elements specify the dimensions of the colorbar. The Units property determines the position units."
Notice though that "The associated axes does not resize to accommodate the colorbar when the Location property is 'manual'" (which is set automatically if you specify Position.)
Note that the Position is relative to the figure, not the axes. If you are using subplot() you might want to change the axes Position to fit the colorbar.

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

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by