Question

I use xlab="" to suppress the x-label but still get a 'sub-x-label' in my dendrogram. How can I remove this and remove any extra space under the dendrogram?

require(graphics)

hc <- hclust(dist(USArrests), "ave")
plot(hc,xlab="")

enter image description here

Was it helpful?

Solution

To remove the subtitle use the following:

plot(hc, xlab="", sub="")

To remove the bottom margin (see ?par for details):

par(mar=c(0, 4, 4, 2)) # c(bottom, left, top, right)
plot(hc, xlab="", sub="")

OTHER TIPS

May be plot(hc,xlab='', sub="") removes it.

You need

op <- par(mar = c(2,4,4,2) + 0.1))
plot(hc, xlab = "", sub = "")
par(op)

The first par() line stores the current settings and then sets the margin to be 2 lines bottom, 4 on the left and top and 2 lines on the right (plus a bit). Then we plot setting an empty string for the *sub*title via argument sub. Finally we set the parameters back to what they were before the first line.

I left a bit of room on the bottom margin as I'm not sure how far the labels can hand down. Change the first 2 in mar = c(2,4,4,2) to something smaller if you want less space down the bottom.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top