why is the color bar disrupting my GUI output??
2 次查看(过去 30 天)
显示 更早的评论
I am making a GUI with matlab. I have 4 axes each displaying a figure that is generated from a script, that has input from the user through a drop-down menu. though as the user clicks for the first time the GUI seems to work perfectly, while if the user chooses a second selection axes3 disappears.
After looking into the code I figured out the piece of code that is causing the trouble:
axes(handles.axes3);
y1 = 1:10;
[AX A B]=plotyy(Data_last_values(:,9),Data_last_values(:,6),Data_last_values(:,9),Data_last_values(:,8), @(x, y) scatter(x, y, [], Data_last_values(:,5)));%-> volumetric mass flow is used in the color bar
colormap(jet(20));
h=colorbar;
ylabel(AX(1), 'T_{in} [C]');
ylabel(AX(2), 'DT [C]');
xlabel('Q_{out} [W]')
ylabel(h, 'Volumetric Flow [Lt/min]')
title('figure 1 - Heat Exchanger HEX')
grid minor
I noticed that if I comment out the colorbar everything works perfectly, or replace the plotyy with scatter. The plot that I would like to make is a double yy scatter plot with a colorbar.
Any help would be super aprciated !! :)
0 个评论
回答(1 个)
Walter Roberson
2015-8-26
Remember that plotyy() creates a new axes for the second y. That axes might or might not be the current axes after the plotyy() call. colorbar() by default works on the current axes.
You should be calling colorbar with the axes you want it to be associated with.
Note: before R2014b, colorbar creates an axes itself, and that axes could become the current axes too. From R2014b onwards, colorbar creates a colorbar object rather than a new axes.
1 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Two y-axis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!