r- how to edit elements on x axis in image.plot -
i have created image plot data:
sample p p.1 p.2 p.3 p.4 p 1.0000000 0.24077171 -0.66666667 -0.49009803 0.61237244 p.1 0.2407717 1.00000000 0.09028939 -0.83444087 0.14744196 p.2 -0.6666667 0.09028939 1.00000000 0.21004201 0.10206207 p.3 -0.4900980 -0.83444087 0.21004201 1.00000000 -0.08574929 p.4 0.6123724 0.14744196 0.10206207 -0.08574929 1.00000000
using code:
image.plot(sample,col=redblue(191), zlim=c(-1,1))
i image:
instead of 0.0 0.2 0.4.. on x , y axes, want p p.1 p.2... how that? thank time , consideration?
my heatmap looks this:
its not symmetric. can please fix this? using code:
shades=c(seq(-1,-0.5,length=64), seq(-0.5,0.5, length=64), seq(0.5,1,length=64))
heatmap.2(sample, dendrogram='none', symm=true, rowv=false, colv=false, key=true, cexcol=0.7, cexrow=1,scale="row", keysize=1, col=redblue(191), breaks=shades)
here better-ish solution:
par(mar=c(5,4.5,4,7)) image(sample, col=rainbow(25), axes=f) #redblue() doesn't work on computer. axis(2) axis(1, at=seq(0,0.8,0.2), labels=rownames(sample)) image.plot(sample, legend.only=t)
edit: plot below looking for?
sample = cor(matrix(rnorm(400), nrow=20)) image(cor(matrix(rnorm(400), nrow=20)), axes=f) mtext(text=c(paste("country",1:21)), side=2, line=0.3, at=seq(0,1,0.05), las=1, cex=0.8) mtext(text=c(paste("country",1:21)), side=1, line=0.3, at=seq(0,1,0.05), las=2, cex=0.8) image.plot(sample, legend.only=t)
Comments
Post a Comment