Skip to contents

View ggplot curve plots in a pdf file.

Usage

view_ggplot_pdf(
  ggplot_list,
  filename = "curve_plot.pdf",
  ncol_per_page = 2,
  nrow_per_page = 2,
  width = 15,
  height = 8,
  testing = FALSE
)

Arguments

ggplot_list

list of plots to be arranged into a grid for each pdf page. The list of plot should can be created via the function add_ggplot_panel(). The function will create a data frame or tibble and the column name "panel" should contain the list of plots.

filename

File name of the pdf document. Default: 'curve_plot.pdf'

ncol_per_page

Number of columns of plots allowed in one page of the pdf document. Default: 2

nrow_per_page

Number of rows of plots allowed in one page of the pdf document. Default: 2

width

The width of one pdf page. Default: 15

height

The height of one pdf page. Default: 8

testing

To indicate if we are running a test, if so, no pdf report is given out. Default: FALSE

Examples

sample_name <- c(
  "Sample_010a", "Sample_020a", "Sample_040a",
  "Sample_060a", "Sample_080a", "Sample_100a",
  "Sample_010b", "Sample_020b", "Sample_040b",
  "Sample_060b", "Sample_080b", "Sample_100b"
)

curve_1_good_linearity <- c(
  22561, 31178, 39981, 48390, 52171, 53410,
  32561, 41178, 49981, 58390, 62171, 63410
)

curve_2_good_linearity <- c(
  2299075, 4136350, 7020062, 8922063, 9288742, 11365710,
  2300075, 4137350, 7021062, 8923063, 9289742, 11366710
)

curve_data <- tibble::tibble(
  Sample_Name = sample_name,
  `Curve_1` = curve_1_good_linearity,
  `Curve_2` = curve_2_good_linearity
)

concentration <- c(
  10, 20, 40, 60, 80, 100,
  10, 20, 40, 60, 80, 100
)

curve_batch_name <- c(
  "B1", "B1", "B1", "B1", "B1", "B1",
  "B2", "B2", "B2", "B2", "B2", "B2"
)

curve_batch_annot <- tibble::tibble(
  Sample_Name = sample_name,
  Curve_Batch_Name = curve_batch_name,
  Concentration = concentration
)

# Create curve table
curve_table <- create_curve_table(
  curve_batch_annot = curve_batch_annot,
  curve_data_wide = curve_data,
  common_column = "Sample_Name",
  signal_var = "Signal",
  column_group = "Curve_Name"
)

# Create a ggplot table without curve summary
ggplot_table_auto <- add_ggplot_panel(curve_table)

# Get the list of ggplot list for each group
ggplot_list <- ggplot_table_auto$panel

# Create a pdf report, set testing = FALSE to output results
pdf_page_list <- view_ggplot_pdf(ggplot_list, testing = TRUE)