From 96446c72ee02b3bee911c20d4e14e9bdc3409413 Mon Sep 17 00:00:00 2001 From: Peter Carbonetto Date: Wed, 29 Jan 2025 12:30:01 -0600 Subject: [PATCH] Fixed an issue with structure_plot_ggplot_call() to allow for an L matrix that does not have rows summing to 1. --- DESCRIPTION | 2 +- R/structure_plot.R | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8c07785..57c5ad0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Encoding: UTF-8 Type: Package Package: fastTopics -Version: 0.7-1 +Version: 0.7-2 Date: 2025-01-29 Title: Fast Algorithms for Fitting Topic Models and Non-Negative Matrix Factorizations to Count Data diff --git a/R/structure_plot.R b/R/structure_plot.R index a2f2617..0bc0ea8 100644 --- a/R/structure_plot.R +++ b/R/structure_plot.R @@ -364,9 +364,12 @@ structure_plot_ggplot_call <- function (dat, colors, ticks = NULL, dat <- mutate(dat,"bot" = coalesce(lag(.data$top),0)) dat <- ungroup(dat) dat <- dat[,c("sample","topic","top","bot")] + upper <- max(dat$top) + res <- res/upper rasterdat <- dat["sample"] rasterdat <- crossing(rasterdat, - data.frame("y" = seq(0 + res/2,1 - res/2,by = res))) + data.frame("y" = seq(0 + res/2,upper - res/2, + by = res))) rasterdat <- left_join(rasterdat,dat, by = join_by("sample",x$y > y$bot,x$y < y$top)) return(ggplot(rasterdat,aes_string(x = "sample",y = "y",fill = "topic")) +