Angelo
Angelo

Reputation: 5059

Adjusting font size of axis labels in levelplot function in R

I have matrix of 90 by 90 and I am trying to get an array correlation matrix. Using the following command:

pdf('corr.pdf')
data <- read.table("test", header=T) 
z <- cor(data)
levelplot(z)
dev.off() 

I get an image like this and my tags are getting smudged enter image description here

Please give your suggestions to improve the image.

Thank you

Upvotes: 2

Views: 15779

Answers (3)

Angelo
Angelo

Reputation: 5059

And THE WINNER IS:

pdf('corr.pdf')
data <- read.table("test", header=T)
z <- cor(data)
heatmap.2(z, Rowv=FALSE, Colv=FALSE, dendrogram="none", 
          key=TRUE, density.info="none", trace="none", 
          col=colorpanel(100, lowColor, highColor), scale="none",cexRow=0.3, cexCol=0.3 )
dev.off()

Upvotes: -2

TemplateRex
TemplateRex

Reputation: 70536

EDIT: Take the first example from the levelplot manual and change the scales=list(log="e") argument to scales=list(log="e",x=list(cex=.3),y=list(cex=.3)):

x <- seq(pi/4, 5 * pi, length.out = 100)
y <- seq(pi/4, 5 * pi, length.out = 100)
r <- as.vector(sqrt(outer(x^2, y^2, "+")))
grid <- expand.grid(x=x, y=y)
grid$z <- cos(r^2) * exp(-r/(pi^3))
levelplot(z~x*y, grid, cuts = 50, 
      scales=list(log="e",x=list(cex=.3),y=list(cex=.3)), xlab=list(cex=.05),
      ylab=list(cex=.25), main=list(label="Weird Function", cex=5), sub="with log scales",
      colorkey = FALSE, region = TRUE)

This will reduce the axis labels' font sizes with a factor of .3.

Upvotes: 10

Etienne Low-D&#233;carie
Etienne Low-D&#233;carie

Reputation: 13443

You can correct this with

pdf('corr.pdf', width=100, height=100)
data <- read.table("test", header=T) 
z <- cor(data)
levelplot(z)
dev.off()

Upvotes: 3

Related Questions