Skip to content

Commit

Permalink
fix: plot(lcModel) with ggplot options works again (#153). added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
niekdt committed May 2, 2024
1 parent d611ecf commit 5e284c6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/model.R
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@ setMethod('plotFittedTrajectories', 'lcModel', function(object, ...) {
#' Can be the cluster names or index.
#' By default, all clusters are shown.
#' @inheritDotParams clusterTrajectories
#' @param ... Arguments passed to [clusterTrajectories()], [trajectories()], and [ggplot2::geom_line()] for plotting the cluster trajectory lines.
#' @param ... Arguments passed to [clusterTrajectories()], and [ggplot2::geom_line()] for plotting the cluster trajectory lines.
#' @return A `ggplot` object.
#' @seealso [plotTrajectories] [plot]
#' @examples
Expand Down Expand Up @@ -1356,7 +1356,7 @@ setMethod('plotClusterTrajectories', 'lcModel',
assert_that(length(clusterLabels) == nClusters(object))

clusData = clusterTrajectories(object, at = at, what = what, ...)
trajData = trajectories(object, ...)
trajData = trajectories(object)

.plotClusterTrajs(
clusData,
Expand Down
17 changes: 17 additions & 0 deletions tests/testthat/test-plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,20 @@ test_that('plotClusterTrajectories.lcModel with ordening', {
})


test_that('plot.lcModel', {
p1 = plot(testModel1)
expect_true(is.ggplot(p1))

p3 = plot(testModel3)
expect_true(is.ggplot(p3))
})


test_that('plot.lcModel with options', {
p1 = plot(testModel1, size = 1)
expect_true(is.ggplot(p1))

p3 = plot(testModel3, alpha = 1)
expect_true(is.ggplot(p3))
})

0 comments on commit 5e284c6

Please sign in to comment.