I'm having a problem when using heatmap.  Even though the diagonal of my
matrix is all the same value, the diagonal of my heatmap is not all the same
color.  Any suggestions?

 

Here is some reproducible code:

#########################################

# Get data

nba <- read.csv("http://datasets.flowingdata.com/ppg2008.csv", sep=",")

 

# Reorder

nba <- nba[order(nba$PTS),]

 

# Name the rows and then eliminate the 1st row

row.names(nba) <- nba$Name

nba <- nba[,2:20]

# nba2 <- nba[1:10,] ## use these if you only want to look @ 10 players

 

# Compute how "similar" players are by doing a correlation between their
statistical sets

psim = cor(t(nba))

# psim2 = cor(t(nba2))

 

# Note: everyone has a self-correlation of 1

diag(abs(psim))

# diag(abs(psim2))

 

# But the diagonal doesn't always look the same

heatmap(abs(psim))

# heatmap(abs(psim2))

#####################################

 

Thanks!

-Steven Wolf

Lyman Briggs College

Department of Physics and Astronomy

Michigan State University


	[[alternative HTML version deleted]]

