How to prevent colorbar overlapping in the right y axis
古いコメントを表示
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.

採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Colorbar についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!