How can I modify the figure properties of a CLUSTERGRAM object in the BioInformatics Toolbox in MATLAB 7.6.0 (R2008a)?

7 views (last 30 days)
I have created a clustergram object using the following code:
Data = rand(20,20).* repmat(floor(5.*(rand(1,20))),20,1);
LB = strcat('LOONNNNNGGGRow',arrayfun(@num2str,1:20,'UniformOutput',0));
SB = strcat('Column',arrayfun(@num2str,1:20,'UniformOutput',0));
CGobj=clustergram(Data,'RowLabels',LB,'ColumnLabels',SB,'Standardize',3, 'Cluster',1, 'DisplayRange',10);
set(CGobj,'Linkage', 'complete','Dendrogram', 5);
I would like to be able to modify the properties of the clustergram figure. For example, I would like to change the background color or add a title.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 Jan 2010
This enhancement has been incorporated in Release 2009b (R2009b). For previous product releases, read below for any possible workarounds:
To modify the properties of the clustergram figure, it is necessary to create a figure out of the clustergram and manipulate the figure properties. This can be done interactively or programmatically.
To perform the steps interactively:
1. Go to the menu bar of the clustergram object and navigate to File->Print to Figure. This will create a figure object whose properties you can modify.
2. Click on the arrow pointer tool and double click on the object in the figure window that you wish to modify. Or, on the Menu bar of the new figure, select the Edit menu, and then select the object whose properties you wish to modify.
3. In the Property Editor that opens up, edit the desired properties or choose "More Properties" to see additional properties.
For more information on using the property editor, open the MATLAB documentation by typing 'doc' at the MATLAB command prompt. Then navigate to:
MATLAB->Graphics->Plots and Plotting Tools->Plotting Tools - Interactive Plotting->Property Editor
To make the changes programmatically it is necessary to grab a handle to to the figure associated with the clustergram and then manipulate the figure properties. The following code demonstrates how to obtain the figure handle:
First, make all handles visible. This is necessary because clustergram objects are created with 'HandleVisibility' property set to 'off':
set(0,'ShowHiddenHandles','on')
Then, get all handles under the root object:
allhnds = get(0,'Children');
Find the handles that correspond to clustergram objects
cgfigidx = strmatch('Clustergram',get(allhnds,'Tag'));
cffighnd = allhnds(cgfigidx);
Make the non-visible handles hidden again
set(0,'showhiddenHandles','off')
Finally, if there is more than one clustergram object, operate on the last one in the list.
if length(cffighnd)>1
warning('More than one clustergram handle found. Using most recent clustergram')
cffighnd = cffighnd(end);
end
It is now possible to modify the figure properties using the figure SET command.

More Answers (0)

Products


Release

R2008a

Community Treasure Hunt

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

Start Hunting!