从Bioinformatics Library - Matlab保存从HeatMap()生成的图形

时间:2015-01-13 22:21:15

标签: matlab save heatmap

我想从生物信息学库中保存我生成HeatMap()函数的图像。

我无法想象没有手动导出数据的图像。

我更倾向于使用HeatMap而不是Imagesc,因为它会自动将数据缩放到平均值。

2 个答案:

答案 0 :(得分:1)

我没有matlab的Bioinformatics Library,但是你应该能够使用函数gcf获得当前数字。它不是最稳定的方式,但在大多数情况下,这将是非常好的。然后,您可以使用saveas将图形保存为图形或图像。

HeatMap(...);
hFig = gcf;
saveas(hFig,'myName','png'); % You can use other image types as well and also `'fig'`

还有第二种方式。 HeatMap类还包含plot方法。此方法可以将图形句柄返回到HeatMap图,然后使用saveas保存图像。:

hHM = HeatMap(...);
hFig = plot(hHM);
saveas(hFig,'myName','png'); 

答案 1 :(得分:0)

我分享了我分析TCGA的某些数据时使用的Matlab代码的一部分

#I was considering two gene expression level taken from cancer disead tissue and 
# healthy tissues comparing them with this Heatmap
labela=Gene;
labelb=Gene2;
data1=[dataN(indg,:) dataC(indg,:); dataN(indg2,:) dataC(indg2,:);];
H=HeatMap(data1,'RowLabels', 
{labela,labelb},'Standardize','row','Symmetric','true','DisplayRange',2);
 addTitle(H,strcat('HeatMap',project));
 addXLabel(H,'patients');
 addYLabel(H,'geni');

    #I have allocated the plot in a variable
 fig=plot(H);
 # Then I saved the plot
 saveas(fig,strcat('D:\Bioinformatica\Tesina... 
         Prova2\Risultati_lihc\',dirname,'\HM.fig'));

但是,如果您必须运行一个对象,我建议您不要花很多时间在代码上(即使探索和增强您的知识总是一件好事),我之所以使用它是因为每次运行管道时都这样做。否则你可以继续

1)文件---->导出设置

First!

2)导出

Second!

3)以您想要的格式保存!

enter image description here