Skip to content

Commit 1959a30

Browse files
authored
release 0.7.4
1 parent cbcf90d commit 1959a30

File tree

7 files changed

+200
-43
lines changed

7 files changed

+200
-43
lines changed

.Rbuildignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@
1111
^\.github$
1212
^\.devcontainer$
1313
^Rplots\.pdf$
14-
1514
^doc$
1615
^Meta$

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: gridify
33
Title: Enrich Figures and Tables with Custom Headers and Footers and More
4-
Version: 0.7.3
4+
Version: 0.7.4
55
Authors@R: c(
66
person("Maciej", "Nasinski", , "Maciej.Nasinski@ucb.com", role = c("aut", "cre")),
77
person("Alexandra", "Wall", , "Alexandra.Wall@ucb.com", role = "aut"),
@@ -17,7 +17,8 @@ Authors@R: c(
1717
)
1818
Description: A simple and flexible tool designed to create enriched figures and tables by providing a way to add text
1919
around them through predefined or custom layouts.
20-
Any input which is convertible to 'grob' is supported, like 'ggplot', 'gt' or 'flextable'.
20+
Any input which is convertible to 'grob' is supported, like 'ggplot', 'gt' or 'flextable'.
21+
Based on R 'grid' graphics, for more details see Paul Murrell (2018) <doi:10.1201/9780429422768>.
2122
License: Apache License 2.0
2223
URL: https://pharmaverse.github.io/gridify/
2324
BugReports: https://github.com/pharmaverse/gridify/issues

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# gridify 0.7.4
2+
3+
* Updated `export_to` method examples to not use `dontrun`.
4+
* Added doi in the DESCRIPTION file.
5+
16
# gridify 0.7.3
27

38
* Improved `show_spec` method for `gridifyLayout`.

R/gridify-methods.R

Lines changed: 94 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,7 @@ setMethod(
170170
stop("The text argument is not a character string.")
171171
}
172172

173-
if (
174-
!(is.null(mch) ||
175-
(inherits(mch, "numeric") && length(mch) == 1) && mch > 0)
176-
) {
173+
if (!(is.null(mch) || (inherits(mch, "numeric") && length(mch) == 1) && mch > 0)) {
177174
stop("The mch argument is not a positive numeric value.")
178175
}
179176

@@ -1007,40 +1004,116 @@ setMethod("show", "gridifyLayout", function(object) {
10071004
#' set_cell("footer_right", "Page xx of nn") %>%
10081005
#' set_cell("watermark", "DRAFT")
10091006
#'
1010-
#' \dontrun{
1011-
#' export_to(gridify_obj, to = "output.png")
1012-
#' export_to(gridify_obj, to = "output.png", width = 2400, height = 1800, res = 300)
1007+
#' # Export a result to different file types
1008+
#'
1009+
#' # Different file export formats require specific capabilities in your R installation.
1010+
#' # Use capabilities() to check which formats are supported in your R build.
10131011
#'
1014-
#' export_to(gridify_obj, to = "output.jpeg")
1015-
#' export_to(gridify_obj, to = "output.jpeg", width = 2400, height = 1800, res = 300)
1012+
#' # PNG
1013+
#' temp_png_default <- tempfile(fileext = ".png")
1014+
#' export_to(
1015+
#' gridify_obj,
1016+
#' to = temp_png_default
1017+
#' )
10161018
#'
1017-
#' export_to(gridify_obj, to = "output.tiff")
1018-
#' export_to(gridify_obj, to = "output.tiff", width = 2400, height = 1800, res = 300)
1019+
#' temp_png_custom <- tempfile(fileext = ".png")
1020+
#' export_to(
1021+
#' gridify_obj,
1022+
#' to = temp_png_custom,
1023+
#' width = 2400,
1024+
#' height = 1800,
1025+
#' res = 300
1026+
#' )
10191027
#'
1020-
#' export_to(gridify_obj, to = "outputA4.pdf")
1021-
#' export_to(gridify_obj, to = "outputA4long.pdf", width = 8.3, height = 11.7)
1028+
#' # JPEG
1029+
#' temp_jpeg_default <- tempfile(fileext = ".jpeg")
1030+
#' export_to(
1031+
#' gridify_obj,
1032+
#' to = temp_jpeg_default
1033+
#' )
10221034
#'
1023-
#' # Use different pdf device
1035+
#' temp_jpeg_custom <- tempfile(fileext = ".jpeg")
10241036
#' export_to(
10251037
#' gridify_obj,
1026-
#' to = "outputA4long.pdf", device = grDevices::cairo_pdf, width = 8.3, height = 11.7
1038+
#' to = temp_jpeg_custom,
1039+
#' width = 2400,
1040+
#' height = 1800,
1041+
#' res = 300
10271042
#' )
10281043
#'
1044+
#' # TIFF
1045+
#' temp_tiff_default <- tempfile(fileext = ".tiff")
1046+
#' export_to(
1047+
#' gridify_obj,
1048+
#' to = temp_tiff_default
1049+
#' )
1050+
#'
1051+
#' temp_tiff_custom <- tempfile(fileext = ".tiff")
1052+
#' export_to(
1053+
#' gridify_obj,
1054+
#' to = temp_tiff_custom,
1055+
#' width = 2400,
1056+
#' height = 1800,
1057+
#' res = 300
1058+
#' )
1059+
#'
1060+
#' # PDF
1061+
#' temp_pdf_A4 <- tempfile(fileext = ".pdf")
1062+
#' export_to(
1063+
#' gridify_obj,
1064+
#' to = temp_pdf_A4
1065+
#' )
1066+
#'
1067+
#' temp_pdf_A4long <- tempfile(fileext = ".pdf")
1068+
#' export_to(
1069+
#' gridify_obj,
1070+
#' to = temp_pdf_A4long,
1071+
#' width = 8.3,
1072+
#' height = 11.7
1073+
#' )
1074+
#'
1075+
#' # Use different pdf device - cairo_pdf
1076+
#' temp_pdf_A4long_cairo <- tempfile(fileext = ".pdf")
1077+
#' export_to(
1078+
#' gridify_obj,
1079+
#' to = temp_pdf_A4long_cairo,
1080+
#' device = grDevices::cairo_pdf,
1081+
#' width = 8.3,
1082+
#' height = 11.7
1083+
#' )
1084+
#'
1085+
#' # Multiple Objects - a list
1086+
#'
10291087
#' gridify_list <- list(gridify_obj, gridify_obj)
10301088
#'
1031-
#' export_to(gridify_list, to = "multipageA4.pdf")
1032-
#' export_to(gridify_list, to = "multipageA4long.pdf", width = 8.3, height = 11.7)
1033-
#' export_to(gridify_list, to = "multipageA4long.pdf", width = 8.3, height = 11.7)
1089+
#' temp_pdf_multipageA4 <- tempfile(fileext = ".pdf")
1090+
#' export_to(
1091+
#' gridify_list,
1092+
#' to = temp_pdf_multipageA4
1093+
#' )
1094+
#'
1095+
#' temp_pdf_multipageA4long <- tempfile(fileext = ".pdf")
1096+
#' export_to(
1097+
#' gridify_list,
1098+
#' to = temp_pdf_multipageA4long,
1099+
#' width = 8.3,
1100+
#' height = 11.7
1101+
#' )
10341102
#'
1035-
#' export_to(gridify_list, to = c("page1.png", "page2.png"))
1103+
#' temp_png_multi <- c(tempfile(fileext = ".png"), tempfile(fileext = ".png"))
10361104
#' export_to(
10371105
#' gridify_list,
1038-
#' to = c("page1_96res.png", "page2_96res.png"),
1106+
#' to = temp_png_multi
1107+
#' )
1108+
#'
1109+
#' temp_png_multi_custom <- c(tempfile(fileext = ".png"), tempfile(fileext = ".png"))
1110+
#' export_to(
1111+
#' gridify_list,
1112+
#' to = temp_png_multi_custom,
10391113
#' width = 800,
10401114
#' height = 600,
10411115
#' res = 96
10421116
#' )
1043-
#' }
10441117
#'
10451118
#' @export
10461119
setGeneric("export_to", function(x, to, device = NULL, ...) {

inst/WORDLIST

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ centers
55
CMD
66
Codecov
77
Dallimore
8+
doi
89
HersheySerif
910
Laetitia
1011
Lemoine
1112
McShea
1213
Montironi
14+
Murrell
1315
Ncol
1416
Nrow
1517
PatientID

man/export_to.Rd

Lines changed: 93 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/simple_examples.Rmd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,11 @@ The `background` argument works across all built-in layout functions, including
462462

463463
```{r}
464464
figure_obj <- ggplot2::ggplot(data = mtcars, ggplot2::aes(x = mpg, y = wt)) +
465-
ggplot2::theme(
465+
ggplot2::theme(
466466
plot.background = ggplot2::element_rect(fill = "beige", colour = NA), # Entire plot background
467467
panel.background = ggplot2::element_rect(fill = "beige", colour = NA), # Panel (where data is plotted)
468-
panel.border = ggplot2::element_rect(colour = "black", fill = NA)) +
468+
panel.border = ggplot2::element_rect(colour = "black", fill = NA)
469+
) +
469470
ggplot2::geom_line()
470471
471472
g <- gridify(figure_obj, layout = simple_layout(background = "beige")) %>%

0 commit comments

Comments
 (0)