Skip to contents

plotDendro() extracts plotting data from an stats::hclust object, plots a dendrogram, and then saves it as a .pdf.

Usage

plotDendro(
  dendro,
  label = TRUE,
  labelSize = 2.5,
  expandX = c(0.03, 0.03),
  expandY = c(0.3, 0.08),
  nBreaks = 4,
  save = TRUE,
  file = "Dendrogram.pdf",
  width = 11,
  height = 4.25,
  verbose = TRUE
)

Arguments

dendro

An stats::hclust object generated by getDendro().

label

A logical(1) indicating whether to add labels to the dendrogram.

labelSize

A numeric(1) specifying the size of the label text.

expandX

A numeric(2) giving the x-axis multiplicative range expansion factors as upper limit, lower limit.

expandY

A numeric(2) giving the y-axis multiplicative range expansion factors as upper limit, lower limit.

nBreaks

A numeric(1) specifying the number of breaks used for the y-axis.

save

A logical(1) indicating whether to save the plot.

file

A character(1) giving the file name (.pdf) for the saved plot.

width

A numeric(1) specifying the width in inches of the saved plot.

height

A numeric(1) specifying the height in inches of the saved plot.

verbose

A logical(1) indicating whether messages should be printed.

Value

A ggplot object.

Details

plotDendro() is designed to be used in combination with getDendro(). A ggplot object is produced and can be edited outside of this function if desired.

See also

Examples

if (FALSE) {

# Assess Sample Similarity
getDendro(methAdj, distance = "euclidean") %>%
        plotDendro(file = "Sample_Dendrogram.pdf", expandY = c(0.25,0.08))

# Examine Correlations between Modules
moduleDendro <- getDendro(MEs, distance = "bicor")
plotDendro(moduleDendro, labelSize = 4, nBreaks = 5,
           file = "Module_ME_Dendrogram.pdf")

# Characterize Correlations between Samples
sampleDendro <- getDendro(MEs, transpose = TRUE, distance = "bicor")
plotDendro(sampleDendro, labelSize = 3, nBreaks = 5,
           file = "Sample_ME_Dendrogram.pdf")

# Examine Correlations between Traits
traitDendro <- getCor(MEs, y = colData, corType = "bicor",
                      robustY = FALSE) %>%
        getDendro(transpose = TRUE)
plotDendro(traitDendro, labelSize = 3.5, expandY = c(0.65,0.08),
           file = "Trait_Dendrogram.pdf")
}