Hi,
I'm looking for a way to add xticks to a clustergram which I am creating using the function clustergram.
I simply want xticks from 0 to 4000 in spaces of 500, but could not find this option in the function.
Thanks a lot!

댓글 수: 3

Adam Danz
Adam Danz 2019년 11월 14일
Clustergrams use a heatmap object which is notoriously difficult to customize. That being said, we may be able to recommend some things to try but first we need more information.
Could you provide a minimal working example that reproduces your clustergram with minimal data? You could re-create your input matrix using rand() that matches the size of your input and any other additional inputs to clustergram you're using.
Shani Hadar
Shani Hadar 2019년 11월 24일
Hey,
LFC_all = rand(4062,20)
h = clustergram(LFC_all','ColorMap','jet','ColumnPDist','correlation','RowLabels',condition_Names,'DisplayRange',3,'OptimalLeafOrder',true,'Linkage','average','dendrogram',3)
title = addTitle(h,{'\fontsize{30} Clustergram of LFC of significant genes','\fontsize{20} Linkage: Average, Pdist: Correlation'});
and I invision something like this beneath my clustergram..
___________________|______________________|________________________|_______
500 1000 1500
So it will be easier to assess whats going on.
looks simple enough but I couldn't find an option in the clustergram fuction to add it.
Thanks
Adam Danz
Adam Danz 2019년 11월 24일
I see. Give my answer a try and let us know if this is what you were looking for.

댓글을 달려면 로그인하십시오.

 채택된 답변

Adam Danz
Adam Danz 2019년 11월 24일
편집: Adam Danz 2019년 11월 25일

0 개 추천

Clustergrams use a heatmap object which is notoriously difficult to customize. The numeric labels along the rows and columns can be considered as 'XTickLabels' or 'YTickLabels' and they do not appear if the number of rows or columns becomes large. Here's a demo that shows how to display every n-th tick label along the x axis.
% Create dense clustergram
% The x tick labels will not appear due to having too many columns
data = rand(20,2000);
h = clustergram(data)
% Get heatmap axes handle
% If more than 1 clustergram exists, it will get
% the heatmap to the first clustergram listed
cgFig = findall(0,'Type','Figure','Tag','Clustergram'); %handle to clustergram figure
hpAx = findall(cgFig(1),'Type','Axes','Tag','HeatMapAxes'); %Heatmap axis handle
% Turn on selected x-tick labels: every 100_th tick will be displayed
selection = 1:100:numel(h.ColumnLabels);
hpAx.XTick = selection;
% If you want to override their values with the
% index values, left to right
hpAx.XTickLabels = selection;

댓글 수: 2

Shani Hadar
Shani Hadar 2019년 11월 25일
It worked, thank you
Adam Danz
Adam Danz 2019년 11월 25일
편집: Adam Danz 2019년 11월 25일
Glad I could help!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Raunak Gupta
Raunak Gupta 2019년 11월 19일

0 개 추천

Hi,
From the figure of clustergram, the xticks can be interpretated as the ‘ColumnLabels’ property of the clustergram Object. Thus, by setting the ‘ColumnLabels’ to 0:500:4000 can change the column labels of clustergram. However, the xticks will be set based on the clustering that will be happen and it may not be in ascending order.

카테고리

질문:

2019년 11월 14일

편집:

2019년 11월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by