diff --git a/DESCRIPTION b/DESCRIPTION index fddfdef..4a68214 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ggplate Title: Create Layout Plots of Biological Culture Plates and Microplates -Version: 0.1.0 +Version: 0.1.1 Authors@R: person(given = "Jan-Philipp", family = "Quast", role = c("aut", "cre"), @@ -27,7 +27,7 @@ Suggests: covr, testthat (>= 3.0.0) Depends: - R (>= 4.0) + R (>= 4.1.0) URL: https://github.com/jpquast/ggplate, https://jpquast.github.io/ggplate/ BugReports: https://github.com/jpquast/ggplate/issues diff --git a/NEWS.md b/NEWS.md index 0b43e50..3500e6a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,10 @@ +# ggplate 0.1.1 + +* Fix R version requirement. Is now `4.1.0` and not `4.0.0` anymore. This fixes issue #15. +* Fix issue introduced in version 0.1.0. While attempting to remove trailing zeros, we inadvertently introduced some undesired side effects associated with the format() function. This resulted in incorrectly formatted text labels due to leading and trailing whitespaces. +* Update documentation to inform about `conda` package version. +* Update documentation to inform about potentially undesired behavior of new graphics device being opened by function when used in command line. This can be suppressed by setting `scale` argument. + # ggplate 0.1.0 * Fixed a bug with the `value` argument that would not allow the user to provide a character column with only one value. This fixes issue #10. diff --git a/R/plate_plot.R b/R/plate_plot.R index 6b3c14d..359d151 100644 --- a/R/plate_plot.R +++ b/R/plate_plot.R @@ -480,10 +480,12 @@ plate_plot <- function(data, { if (!missing(label)) ggplot2::geom_text(ggplot2::aes(x = col, y = .data$row_num, - label = paste0(format( + label = format( {{ label }}, - drop0Trailing = F) - )), + drop0Trailing = FALSE, # does not drop trailing 0 + justify = "none", # does not add white spaces for justification + trim = TRUE) # removes leading white spaces + ), colour = data_prep$label_colours, size = label_size_scaled) } + diff --git a/README.Rmd b/README.Rmd index 24311bc..4d277bc 100644 --- a/README.Rmd +++ b/README.Rmd @@ -52,6 +52,12 @@ Note: If you do not have `devtools` installed make sure to do so by removing the devtools::install_github("jpquast/ggplate") ``` +In addition, you can install it via the command line through `conda` since it is also implemented as a [conda-forge package](https://anaconda.org/conda-forge/r-ggplate). + +``` +conda install -c conda-forge r-ggplate +``` + ## Usage In order to use **ggplate** you have to load the package in your R environment by simply calling the `library()` function as shown bellow. @@ -282,6 +288,8 @@ plate_plot( It is possible that the generated plot has overlapping or too spaced out wells. This can be corrected by resizing the output graphics device size until the plot has the desired proportions. If a specific output size is required and the plot does not have the desired proportions you can use the `scale` argument to adjust it as shown below. +_Note: If you run the package directly in the command line, the function opens a new graphics device since it is not already opened like it would be the case in RStudio. If this is not desired you can avoid this by setting the `scale` argument._ + ```{r resize_plot, dpi=260, fig.width=7, fig.height=4} # Create a 24-well plot plate_plot( @@ -294,6 +302,7 @@ plate_plot( scale = 1.45 ) ``` + As you can see, however, now we are running into the problem that the legend is larger than the screen size. With the `legend_n_row` argument you can manually determine the number of rows that should be used for the legend. In this case it is ideal to split the legend into 2 columns by setting `legend_n_row` to 6 rows. In addition we should adjust the `scale` parameter to `1.2` in order to space out wells properly. ```{r 24_well_plate_legend_n_row, dpi=260, fig.width=7, fig.height=4} @@ -309,6 +318,7 @@ plate_plot( legend_n_row = 6 ) ``` + If your dataset has a lot of labels it can become difficult to impossible to distinguish them just by colour as you can see for the dataset below. ```{r discrete_96_well_plate, dpi=260, fig.width=7, fig.height=4} diff --git a/README.md b/README.md index c0ece06..0ad72ef 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,12 @@ removing the comment sign (#). devtools::install_github("jpquast/ggplate") ``` +In addition, you can install it via the command line through `conda` +since it is also implemented as a [conda-forge +package](https://anaconda.org/conda-forge/r-ggplate). + + conda install -c conda-forge r-ggplate + ## Usage In order to use **ggplate** you have to load the package in your R @@ -70,9 +76,9 @@ data(data_continuous_96) # Check the structure of the dataset str(data_continuous_96) -#> tibble [96 × 2] (S3: tbl_df/tbl/data.frame) -#> $ Value: num [1:96] 1.19 0.88 0.17 0.85 0.78 0.23 1.95 0.4 0.88 0.26 ... -#> $ well : chr [1:96] "A1" "A2" "A3" "A4" ... +#> Classes 'tbl_df', 'tbl' and 'data.frame': 96 obs. of 2 variables: +#> $ Value: num 1.19 0.88 0.17 0.85 0.78 0.23 1.95 0.4 0.88 0.26 ... +#> $ well : chr "A1" "A2" "A3" "A4" ... ``` When calling the `str()` function you can see that the data frame of a @@ -379,6 +385,11 @@ until the plot has the desired proportions. If a specific output size is required and the plot does not have the desired proportions you can use the `scale` argument to adjust it as shown below. +*Note: If you run the package directly in the command line, the function +opens a new graphics device since it is not already opened like it would +be the case in RStudio. If this is not desired you can avoid this by +setting the `scale` argument.* + ``` r # Create a 24-well plot plate_plot( @@ -394,12 +405,13 @@ plate_plot( #> scaling factor: 1.45 ``` - As you -can see, however, now we are running into the problem that the legend is -larger than the screen size. With the `legend_n_row` argument you can -manually determine the number of rows that should be used for the -legend. In this case it is ideal to split the legend into 2 columns by -setting `legend_n_row` to 6 rows. In addition we should adjust the + + +As you can see, however, now we are running into the problem that the +legend is larger than the screen size. With the `legend_n_row` argument +you can manually determine the number of rows that should be used for +the legend. In this case it is ideal to split the legend into 2 columns +by setting `legend_n_row` to 6 rows. In addition we should adjust the `scale` parameter to `1.2` in order to space out wells properly. ``` r @@ -419,6 +431,7 @@ plate_plot( ``` + If your dataset has a lot of labels it can become difficult to impossible to distinguish them just by colour as you can see for the dataset below. diff --git a/cran-comments.md b/cran-comments.md index a0b0eb4..8f0acf0 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,6 +1,7 @@ ## Submission -* Fixed two bugs in the `plate_plot()` function. +* Fixed a bug in the `plate_plot()` function (see NEWS). +* Also updated the R version requirement, which was incorrectly set to `4.0.0`, while at least `4.1.0` is needed. ## Test environments * macOS-latest (on GitHub actions), R 4.3.2 diff --git a/man/figures/README-standard_plot-1.png b/man/figures/README-standard_plot-1.png index 1277add..cf965ad 100644 Binary files a/man/figures/README-standard_plot-1.png and b/man/figures/README-standard_plot-1.png differ diff --git a/man/figures/README-standard_plot_384_well_new_gradient-1.png b/man/figures/README-standard_plot_384_well_new_gradient-1.png index 5630fe3..1715472 100644 Binary files a/man/figures/README-standard_plot_384_well_new_gradient-1.png and b/man/figures/README-standard_plot_384_well_new_gradient-1.png differ diff --git a/man/figures/README-standard_plot_384_well_new_limits-1.png b/man/figures/README-standard_plot_384_well_new_limits-1.png index 5ffc526..f4fa336 100644 Binary files a/man/figures/README-standard_plot_384_well_new_limits-1.png and b/man/figures/README-standard_plot_384_well_new_limits-1.png differ diff --git a/man/figures/README-standard_plot_384_well_new_limits_outlier-1.png b/man/figures/README-standard_plot_384_well_new_limits_outlier-1.png index 3ca9298..2ab4026 100644 Binary files a/man/figures/README-standard_plot_384_well_new_limits_outlier-1.png and b/man/figures/README-standard_plot_384_well_new_limits_outlier-1.png differ diff --git a/man/figures/README-standard_plot_48_empty_wells-1.png b/man/figures/README-standard_plot_48_empty_wells-1.png index c0ea411..f68d7e6 100644 Binary files a/man/figures/README-standard_plot_48_empty_wells-1.png and b/man/figures/README-standard_plot_48_empty_wells-1.png differ diff --git a/man/figures/README-standard_plot_labels-1.png b/man/figures/README-standard_plot_labels-1.png index f19f8e6..eed7bd4 100644 Binary files a/man/figures/README-standard_plot_labels-1.png and b/man/figures/README-standard_plot_labels-1.png differ diff --git a/man/figures/README-standard_plot_labels_wells-1.png b/man/figures/README-standard_plot_labels_wells-1.png index 21d93b5..a7ab399 100644 Binary files a/man/figures/README-standard_plot_labels_wells-1.png and b/man/figures/README-standard_plot_labels_wells-1.png differ