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

add class and function to create a plot grid #862

Merged
merged 16 commits into from
Apr 7, 2022

Conversation

IndrajeetPatil
Copy link
Member

@IndrajeetPatil IndrajeetPatil commented Apr 6, 2022

  • createPlotGridConfiguration() (removed after team discussion)
  • ospPlotGridConfiguration
  • plotGrid()
  • examples
  • tests

Related to #856
Part of #674

@IndrajeetPatil IndrajeetPatil marked this pull request as draft April 6, 2022 11:51
@IndrajeetPatil

This comment was marked as outdated.

@IndrajeetPatil

This comment was marked as outdated.

@IndrajeetPatil

This comment was marked as outdated.

@IndrajeetPatil IndrajeetPatil marked this pull request as ready for review April 6, 2022 12:28
@IndrajeetPatil IndrajeetPatil requested review from msevestre, PavelBal, Yuri05 and pchelle and removed request for msevestre April 6, 2022 12:28
@IndrajeetPatil
Copy link
Member Author

Builds are passing. This PR is finished from my end.

@codecov-commenter

This comment was marked as off-topic.

DESCRIPTION Outdated Show resolved Hide resolved
#'
#' library(ospsuite)
#' library(ggplot2)
#' library(tlf)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think library(ggplot2) is not required - tlf loads ggplot automatically

appveyor.yml Show resolved Hide resolved
@IndrajeetPatil

This comment was marked as resolved.

@msevestre

This comment was marked as resolved.

plotGridObj$tagSuffix <- ")"

set.seed(123)
vdiffr::expect_doppelganger(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Roughly speaking, it checks if the generated image matches the existing SVG representing the expected plot.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msevestre, @pchelle Btw, vdiffr is what you could be using to test tlf (cf. Open-Systems-Pharmacology/TLF-Library#92), just like in this PR.

@IndrajeetPatil

This comment was marked as resolved.

@msevestre

This comment was marked as resolved.

@msevestre

This comment was marked as resolved.

#' @param plotList A list containing `ggplot` objects.
#'
#' @return A `PlotGridConfiguration` object.
initialize = function(plotList = NULL) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IndrajeetPatil if you can't add plots after the fact, this argument should be required and non null (and probably with at least one element no?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with either of the options:

  • force users to provide at least a plot list when constructor is called (in which case it should not be NULL)

  • allow creating an empty instance and then users can add plots using the public field (in which case this should be NULL)

R/plotGrid.R Outdated
plotGrid <- function(plotGridConfiguration) {
patchwork::wrap_plots(
PlotGridConfiguration$plotList,
ncol = PlotGridConfiguration$nColumns,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a mix of instance plotGridConfiguration and class PlotGridConfiguration going on here. I don't get it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that was unintentional and introduced in my latest commit.

I will fix it tomorrow.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this.

Following the coding convention-

Class name: UpperCamelCase (PlotGridConfiguration)
Parameter name: lowerCamelCase (plotGridConfiguration)

@msevestre
Copy link
Member

Don't forget to specify in one of your commit "Fixes #xx" otherwise the issue won't close automatically

@msevestre msevestre merged commit c31ecc2 into develop Apr 7, 2022
@msevestre msevestre deleted the 856_plot_grid_configuration branch April 7, 2022 23:36
@IndrajeetPatil
Copy link
Member Author

We didn't have any issue to link to for this PR.

We have a related discussion but AFAIK linking to discussions in a PR doesn't do anything.

@msevestre
Copy link
Member

I see. Let's create issues for code changes next time. These issues , if they are based on discussions, can be succinct and simply point to an ongoing discussion.
Aside from DLL update or NEWS update, we should aim at always having a 1-1 between issues (task or bug fix) and PR

@IndrajeetPatil
Copy link
Member Author

Done: #865

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New class and function to create a plot grid
4 participants