rdendrogramhclust

hang parameter in plot.dendrogram doesn't work (saying ["hang" is not a graphical parameter])


After I have updated to R version 3.6.1 (and updated all the packages), I can't use hang parameter with plot.dendrogram anymore:

data(mtcars)
hc <- hclust(dist(mtcars))
plot(hc) # works as expected

den <- as.dendrogram(hc)
plot(den) # it works
plot(den, hang=0.01) # gives bunch of warnings:
# Warning messages:
# 1: In plot.window(...) : "hang" is not a graphical parameter
# 2: In plot.xy(xy, type, ...) : "hang" is not a graphical parameter
# 3: In axis(side = side, at = at, labels = labels, ...) :
#   "hang" is not a graphical parameter
# 4: In axis(side = side, at = at, labels = labels, ...) :
#   "hang" is not a graphical parameter
# 5: In title(...) : "hang" is not a graphical parameter

Any tips for what is wrong there?

version
# _                           
# platform       x86_64-w64-mingw32          
# arch           x86_64                      
# os             mingw32                     
# system         x86_64, mingw32             
# status                                     
# major          3                           
# minor          6.1                         
# year           2019                        
# month          07                          
# day            05                          
# svn rev        76782                       
# language       R                           
# version.string R version 3.6.1 (2019-07-05)
# nickname       Action of the Toes 

Solution

  • hang= is an argument of as.dendogram, not of plot.*

    hc <- hclust(dist(mtcars[1:10,]))
    
    op <- par(mfrow=c(1, 2))
    plot(as.dendrogram(hc, hang=.01))
    plot(as.dendrogram(hc))
    par(op)
    

    enter image description here