Shaxi Liver
Shaxi Liver

Reputation: 1120

X and Y labels are too close to heatmap

How can I move it a bit further ? I use such code for heatmap:

heatmap(mat_cor_results,Rowv=NA, Colv=NA,scale="none", col=hmcols, xlab= "BBB", ylab= "CCC") ##plot heatmap

It's too close to the heatmap and it doesn't look so nice... Any ideas how to change it ?

Heamap

Upvotes: 0

Views: 1415

Answers (1)

Konrad
Konrad

Reputation: 18585

If you intention is to move the text in xlab and ylab you can simply use margins = c(10,10), as in the code below:

# Data cand chart
data(mtcars)
corr_cars <- cor(mtcars)
heatmap(corr_cars, Rowv=NA, Colv=NA, scale="none", xlab= "BBB", ylab= "CCC", 
        margins = c(10,10))

Would give you the following heatmap: massive distance

If your intention is to move the value axis labels you can do:

# Data cand chart with massive margins
data(mtcars)
corr_cars <- cor(mtcars)
# Insane space
par(mgp=c(5,5,5))
heatmap(corr_cars, Rowv=NA, Colv=NA, scale="none", xlab= "BBB", ylab= "CCC", 
        margins = c(10,10))

which would produce:

massive space

Upvotes: 2

Related Questions