Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revise autoplot() to drop faceting for univariate models #197

Open
mdscheuerell opened this issue Apr 26, 2024 · 0 comments
Open

revise autoplot() to drop faceting for univariate models #197

mdscheuerell opened this issue Apr 26, 2024 · 0 comments
Labels
enhancement not a bug. an improvement

Comments

@mdscheuerell
Copy link

The default behavior of autoplot_marssPredict() is to add a facet_wrap() for the different observations (or states) with names given by the rownames in the predict object being passed to it (eg, here and here). How about adding functionality to drop the faceting for univariate models so they don't contain the facet label? For example, something like

if(length(unique(df$.rownames)) == 1) {
  p1 <- p1 +
    ggplot2::geom_line(linetype = plotpar$line.type, color = plotpar$line.col, linewidth = plotpar$line.size) +
    ggplot2::xlab("Time") + ggplot2::ylab("Estimate") +
    ggplot2::ggtitle(plottitle)
} else {
  p1 <- p1 +
    ggplot2::geom_line(linetype = plotpar$line.type, color = plotpar$line.col, linewidth = plotpar$line.size) +
    ggplot2::xlab("Time") + ggplot2::ylab("Estimate") +
    ggplot2::facet_wrap(~ df$.rownames, scale = "free_y") +
    ggplot2::ggtitle(plottitle)
}
@mdscheuerell mdscheuerell added the enhancement not a bug. an improvement label Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement not a bug. an improvement
Projects
None yet
Development

No branches or pull requests

1 participant