Skip to content

Commit

Permalink
Merge pull request #16 from jpquast/Update-documentation
Browse files Browse the repository at this point in the history
Update documentation
  • Loading branch information
jpquast authored Dec 2, 2023
2 parents 718d486 + 2a0a30b commit 8b3ebf7
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 15 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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"),
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
8 changes: 5 additions & 3 deletions R/plate_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
} +
Expand Down
10 changes: 10 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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(
Expand All @@ -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}
Expand All @@ -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}
Expand Down
31 changes: 22 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -394,12 +405,13 @@ plate_plot(
#> scaling factor: 1.45
```

<img src="man/figures/README-resize_plot-1.png" width="100%" /> 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
<img src="man/figures/README-resize_plot-1.png" width="100%" />

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
Expand All @@ -419,6 +431,7 @@ plate_plot(
```

<img src="man/figures/README-24_well_plate_legend_n_row-1.png" width="100%" />

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.
Expand Down
3 changes: 2 additions & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Binary file modified man/figures/README-standard_plot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-standard_plot_384_well_new_gradient-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-standard_plot_384_well_new_limits-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-standard_plot_384_well_new_limits_outlier-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-standard_plot_48_empty_wells-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-standard_plot_labels-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-standard_plot_labels_wells-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8b3ebf7

Please sign in to comment.