Skip to content

Commit ac05382

Browse files
Add configurable labels.cex parameter and improve input validation in plotClustAggregate
- Add `labels.cex` argument to control dendrogram label size (default 0.5) - Move `n.clust` NULL check to only apply when `aggregate == TRUE` - Remove `n.clust` from the general input validation since it's only needed for aggregation - Update documentation accordingly
1 parent 59d9e45 commit ac05382

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

R/plotClustAggregate.R

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,14 @@ plotClustAggregate = function(
7979
file.height = 2500,
8080
file.width = 1200,
8181
file.res = 200,
82+
labels.cex = 0.5,
8283
aggregate = TRUE,
8384
aggr.Nspe = 5,
8485
n.clust = NULL
8586
) {
86-
if (is.null(firt10) | is.null(dbClust) | is.null(n.clust)) {
87+
if (is.null(firt10) | is.null(dbClust)) {
8788
stop(
88-
"Please provide the database of the first ten species, the database used for cluster analysis, and the number of clusters for aggregation."
89+
"Please provide the database of the first ten species and the database used for cluster analysis."
8990
)
9091
}
9192

@@ -109,7 +110,7 @@ plotClustAggregate = function(
109110
par(mfrow = c(1, 1), mar = clust.mar) #graphical settings
110111
plot(
111112
clst.dxt %>%
112-
set("labels_cex", 0.5),
113+
set("labels_cex", labels.cex),
113114
horiz = T
114115
)
115116

@@ -123,11 +124,17 @@ plotClustAggregate = function(
123124
par(mfrow = c(1, 1), mar = clust.mar) #graphical settings
124125
plot(
125126
clst.dxt %>%
126-
set("labels_cex", 0.5),
127+
set("labels_cex", labels.cex),
127128
horiz = T
128129
)
129130
dev.off()
130131
} else if (aggregate == TRUE) {
132+
if (is.null(n.clust)) {
133+
stop(
134+
"Please provide the number of clusters for aggregation."
135+
)
136+
}
137+
131138
groups <- iPastoralist::clustOrder(
132139
cluster.hclust = clst,
133140
cluster.group = T,
@@ -172,7 +179,7 @@ plotClustAggregate = function(
172179
par(mfrow = c(1, 1), mar = clust.mar)
173180
plot(
174181
clst.dxt.aggr %>%
175-
set("labels_cex", 0.5),
182+
set("labels_cex", labels.cex),
176183
horiz = T
177184
)
178185
rect.dendrogram(
@@ -194,7 +201,7 @@ plotClustAggregate = function(
194201
par(mfrow = c(1, 1), mar = clust.mar)
195202
plot(
196203
clst.dxt.aggr %>%
197-
set("labels_cex", 0.5),
204+
set("labels_cex", labels.cex),
198205
horiz = T
199206
)
200207
rect.dendrogram(

man/plotClustAggregate.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)