Insert a colorbar on a GUI?

조회 수: 4 (최근 30일)
Nathan
Nathan 2011년 8월 4일
Hey all,
So I have a Matlab GUI with UI controls that takes user input and does stuff with it. However, I'm looking to add a colorbar on my GUI on the right side, where small bars will appear based on the user input to certain fields. But, there isn't any direct way with guide to do so. How might I go about this? Thanks in advance.
Nathanf

답변 (1개)

Paulo Silva
Paulo Silva 2011년 8월 4일
first select the current axes, just in case you have more than one axes on your gui, you also must have the handle for it (h=axes)
axes(h) %select the current axes, the h holds the handle for it
colorbar %now the current axes got one colorbar next to it
The colorbar is also one axes although it doesn't appear to be one, if you want to draw something on it create the colorbar like this hc=colorbar.
axes(hc) %select the colorbar as current axes
now you can draw lines on it.
Simple example, not using one GUI but it's similar
spy
hc=colorbar;
axes(hc);
line(xlim,[50 50],'LineWidth',8,'Color',[1 1 1])
%notice the white line on the colorbar

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by