On 26/04/2012 9:01 AM, Steven Wolf wrote:> 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?
heatmap() rescales the matrix by default. Use
heatmap(abs(psim), scale="none")
to plot the raw data.
Duncan Murdoch
>
>
>
> 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]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.