Skip to content

Commit afec16a

Browse files
fix(plots): fixed bug in plot_cluster_centers() by removing theme_void()
For some reason, `plot_cluster_centers()` would occassionaly not display the plot. Even on the same input template, sometimes the function would show the plot and sometimes it wouldn't. I can't find any reason why `ggplot2::theme_void()` would cause this problem, but changing it to `ggplot2::theme_bw()` fixes the bug.
1 parent 7f61cd0 commit afec16a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

R/cluster_plot.R

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,14 @@ plot_cluster_centers <- function(template, plot_graphs = FALSE, size=100) {
510510
list(
511511
if (plot_graphs) {ggplot2::geom_segment(data=graphs_by_cluster, aes(x=startx, y=starty, xend=endx, yend=endy), color = "grey30", alpha=0.05)},
512512
ggplot2::geom_segment(aes(x=startx, y=starty, xend=endx, yend=endy), color = "orange"),
513-
xlim(-size, size),
514-
ylim(-size, size),
515-
theme_void(),
516-
facet_wrap(~cluster)
513+
ggplot2::coord_fixed(ratio = 1, xlim = c(-size, size), ylim = c(-size, size), expand = TRUE, clip = "on"),
514+
ggplot2::facet_wrap(~cluster),
515+
ggplot2::labs(x = "x", y = "y"),
516+
ggplot2::theme_bw()
517517
)
518518
}
519-
p <- centers_df %>% ggplot2::ggplot() +
519+
p <- centers_df %>%
520+
ggplot2::ggplot() +
520521
plot_items(plot_graphs)
521522

522523
return(p)

0 commit comments

Comments
 (0)