필터 지우기
필터 지우기

How to prevent colorbar overlapping in the right y axis

조회 수: 4 (최근 30일)
Enis
Enis 2014년 2월 19일
답변: Enis 2014년 2월 19일
Hello, I am new in matlab.
I have a scattered graphic having two y axes.
I wanted to use a colorbar at the right side of the figure, however, the colorbar is overlapping on the right y axis and label.
FigHandle = figure('Position', [1, 1, 1200, 1200]);
h1 = scatter(x,y1,30,z);![enter image description here][1]
ax1 = gca;
grid on
hold(ax1, 'all');
ax2 = axes('Position',get(ax1,'Position'),...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none',...
'XColor','k','YColor','k', 'fontsize',20);
hold(ax2, 'all');
h2 = scatter(x,y2,30,z,'Parent',ax2);
t = colorbar('peer',gca);
colorbar('location','eastoutside')
1) I tried to reduce the width of the plot screen (not figure) so that I may have some space for the colorbar but it didnot work.
2) I tried to increase the width of all figure screen, but the plot screen is also increased, so nothing changed.
I tried several position adjustment codes but I fail to figure out the concept.
In summary, I want to find out a way out to reduce the width of the plot screen, so that there is sufficent space for colorbar.
Many thanks in advance.

채택된 답변

Enis
Enis 2014년 2월 19일
I have found the answer here:
Posting here to help others.

추가 답변 (0개)

카테고리

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