필터 지우기
필터 지우기

Clustergram. Changing the range of the colorbar

조회 수: 15 (최근 30일)
George
George 2021년 4월 30일
댓글: George 2021년 5월 3일
From a 17x17 array, I've plotted the attached clustergram. The array values range from 1 to 5. The values on the diagonal are equal to 1.
I have the following questions:
  1. The colorbar values are obviously wrong. They range from -3 to 3. The correct range should should be 1 to 5. There no negative values in the array. I tried colormapeditor but failed to find an answer to this problem.
  2. Is there a way to change the colours of the clustergram to correspond to the colorbar (say "parula")?
  댓글 수: 6
Adam Danz
Adam Danz 2021년 5월 3일
편집: Adam Danz 2021년 5월 3일
You're missing the line that reads in the table. What is rmsd? When i read in the table using readtable('rmsd.xls') the table cannot be converted to an array.
George
George 2021년 5월 3일
Thank you Adam.
rmsd.xls was imported into the workspace (rmsd) (17x17 table).
Then it was converted to double: rd = table2array(rmsd);
>> size(rd)
ans =
17 17
>> class(rd)
ans =
'double'
The rest of the code that I used to generate the heatmap/clustergram is as per my email of May 1, 2021

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

채택된 답변

Adam Danz
Adam Danz 2021년 5월 3일
편집: Adam Danz 2021년 5월 3일
The color scale is based on standardized values even if standardize is set to none.
You can set the range of standardized values as a scalar using,
cgo_all = clustergram(rd,___);
cgo_all.DisplayRange = ____
which adjusts the range of the colorbar but will still contain negative values because of standardization.
It may be helpful to review this example from the documentation that explains that the data are standardized so that the mean is 0 which is why colorbar values are +/-.
Also see this coursera course that covers Matlab's Clustergram function.
  댓글 수: 2
George
George 2021년 5월 3일
Many thanks once again.
You're absolutely right. I tweeked setting the 'Standardize' flag to 'none'. The diagonal in this case is zero which coincides with the white colour in the colorbar.
George
George 2021년 5월 3일
Accepted

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Management에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by