Skip to content

Commit 9f2b57a

Browse files
committed
Update legend labels in plot_intro and plot_missing
1 parent ad94ad0 commit 9f2b57a

4 files changed

Lines changed: 10 additions & 6 deletions

File tree

R/plot_intro.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ plot_intro <- function(data, geom_label_args = list(), title = NULL, ggtheme = t
4444
scale_y_continuous(labels = percent) +
4545
scale_fill_discrete("Dimension") +
4646
coord_flip() +
47-
labs(x = "Metrics", y = "Value") +
48-
guides(fill = guide_legend(override.aes = aes(label = "")))
49-
geom_label_args_list <- list("mapping" = aes(label = percent(value)))
47+
labs(x = "Metrics", y = "Value")
48+
geom_label_args_list <- list(
49+
"mapping" = aes(label = percent(value)),
50+
"show.legend" = FALSE
51+
)
5052
output <- output +
5153
do.call("geom_label", c(geom_label_args_list, geom_label_args))
5254
## Plot object

R/plot_missing.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ plot_missing <- function(data,
7272
geom_bar(stat = "identity") +
7373
bar_fill +
7474
coord_flip() +
75-
xlab("Features") + ylab("Missing Rows") +
76-
guides(fill = guide_legend(override.aes = aes(label = "")))
77-
geom_label_args_list <- list("mapping" = aes(label = paste0(round(100 * pct_missing, 2), "%")))
75+
xlab("Features") + ylab("Missing Rows")
76+
geom_label_args_list <- list(
77+
"mapping" = aes(label = paste0(round(100 * pct_missing, 2), "%")),
78+
"show.legend" = FALSE
79+
)
7880
output <- output +
7981
do.call("geom_label", c(geom_label_args_list, geom_label_args))
8082
## Plot object
-771 Bytes
Loading
-575 Bytes
Loading

0 commit comments

Comments
 (0)