function cmap(varargin) %# function hot cool jet bone global vel drawcone hslice vslice cmap; if nargin == 0 initialize; colormap cool; else feval(varargin{1}); end function initialize global colormaps % Create the display axis, which occupies most of the figure. dispaxis=subplot('position', [0, .3, .85, .7]); % Create the axis for the GUI controls g=subplot('position', [0, 0, 1, .3]); % Create the axis for the colorbar cbar=subplot('position', [.85, .3, .1, .7]); % Switch to the diplay axis and draw a sphere axes(dispaxis); sphere; % Switch to the GUI control axis and build the GUI axes(g); axis off; colorbar(cbar); % The Colormap radio group, on the right-hand side of the lower axis gy = .20; uicontrol('units', 'normalized', 'string', 'Colormap:', 'style', 'text',... 'position', [.85, gy, .1, .05]); gy = gy - .05; colormaps(1) = uicontrol('units', 'normalized', 'string', 'bone', 'style',... 'radio', 'callback', 'cmap(''bonemap'')',... 'position', [.87, gy, .1, .05], 'value', 0); gy = gy - .05; colormaps(2) = uicontrol('units', 'normalized', 'string', 'cool', 'style',... 'radio', 'callback', 'cmap(''coolmap'')',... 'position', [.87, gy, .1, .05], 'value', 1); gy = gy - .05; colormaps(3) = uicontrol('units', 'normalized', 'string', 'hot', 'style',... 'radio', 'callback', 'cmap(''hotmap'')',... 'position', [.87, gy, .1, .05], 'value', 0); gy = gy - .05; colormaps(4) = uicontrol('units', 'normalized', 'string', 'jet', 'style',... 'radio', 'callback', 'cmap(''jetmap'')',... 'position', [.87, gy, .1, .05], 'value', 0); function activatebutton(colormaps, map) set(colormaps, 'Value', 0); set(gcbo, 'Value', 1); colormap(map) function bonemap(colormaps) global colormaps activatebutton(colormaps, 'bone'); function coolmap(colormaps) global colormaps activatebutton(colormaps, 'cool'); function hotmap(colormaps) global colormaps activatebutton(colormaps, 'hot'); function jetmap(colormaps) global colormaps activatebutton(colormaps, 'jet');