How to save clustergram as fig file using code?

10 ビュー (過去 30 日間)
raym
raym 2021 年 2 月 27 日
コメント済み: Wenhui Qiao 2023 年 3 月 23 日
I generate a clustogram using R2016a,
cgo = clustergram(rand(94,250),...
'RowLabels',repmat({'rowLabel'},1,94),...
'ColumnLabels',repmat({'ColLabel'},1,250),...
'Colormap',redbluecmap,...
'Cluster','column',... %'column'/'row'/'all' or
'DisplayRange',1,...
'DisplayRatio',[0.00001,0.00001]);
The clustergram was shown.
To save it as fig file, one way is to click File-Export Setup-Export, then select fig format.
I want to find a way to save it by code, but save(cgo,'path') does not work as cgo is not a figure object.
One solution is call
fig = cgo.plot
this will show another figure that can be saved as regular figure. However, one info is lost in fig:
When I click on datapoint on cgo image, it will pop up a small window showing x/y label information, but this information is lost if I click on the fig object, andthis information replaced by RGB information instead.
Is there a code to do the examly same thing as "click File-Export Setup-Export, then select fig format."?

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 2 月 27 日
One way:
plot(cgo);
saveas(gcf,'filename1.png')
  1 件のコメント
Wenhui Qiao
Wenhui Qiao 2023 年 3 月 23 日
However, the figure is without colorbar. Anyway to add it? The way below does not work.
plot(cgo);colorbar;
Thanks!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Import and Management についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by