so_graph | R Documentation |
so_graph
makes a graph of simulated vs. observed PK, including
indicating where the predicted parameters fell within X fold of the observed.
so_graph(
PKtable,
PKparameters = NA,
PKorder = "default",
boundary_indicator = "lines",
boundaries = c(1, 1.5, 2),
boundaries_Guest = c(1, 2),
boundary_color_set = "red black",
boundary_color_set_Guest = "red black",
boundary_line_types = "default",
boundary_line_types_Guest = "default",
boundary_line_width = 0.3,
error_bars = "none",
variability_type = "90% CI",
point_color_column,
point_color_set = "default",
legend_label_point_color = NA,
point_shape_column,
point_shape = NA,
point_size = NA,
point_transparency = 1,
legend_label_point_shape = NA,
legend_position = "none",
axis_title_x = "Observed",
axis_title_y = "Simulated",
include_dose_num = NA,
facet_title_size = NA,
title_adjustments = c(),
all_intervals_together = FALSE,
all_AUCs_together = FALSE,
grid_color = NA,
ncol = NULL,
nrow = NULL,
save_graph = NA,
fig_width = 8,
fig_height = 6,
return_list_of_graphs = FALSE,
axis_titles = NA
)
PKtable |
a table in the same format as output from the function
|
PKparameters |
any of the AUC, Cmax, tmax, CL, or half-life PK
parameters included in the output from |
PKorder |
optionally specify the order of the graphs. Leaving this as
"default" puts the graphs in the same order as the columns in the Simcyp
Consultancy Team template for PK tables (plus some guesses at a good order
for PK parameters that are not listed in said template table). Setting this
to "user specified" will make the order of the graphs match the order you
specified with the argument |
boundary_indicator |
how to indicate the boundaries for simulated / observed. Options are "lines" (default), "fill" to get a shaded area, or "none" to remove any indicators of those boundaries. NOTE: There is a known bug within RStudio that causes filled semi-transparent areas like you get with the "fill" option to NOT get graphed for certain versions of RStudio. To get around this, within RStudio, go to Tools –> Global Options –> General –> Graphics –> And then set "Graphics device: backend" to "AGG". Honestly, this is a better option for higher-quality graphics anyway! |
boundaries |
Numerical boundaries to show on the graph. Defaults to the
1.5- and 2-fold boundaries. Indicate boundaries you want like this:
|
boundaries_Guest |
Numerical boundaries to show on the graph when the PK parameter is a mean ratio of the parameter in the presence of a perpetrator / the parameter in the absence of the perpetrator. Please see [BoundariesGuest Galetin 2011 Drug Metab Dispos](https://pubmed.ncbi.nlm.nih.gov/21036951/) for a reference for this type of graph. If you'd rather show straight lines for these parameters instead of BoundariesGuest curves, set this to NA. The default boundaries for BoundariesGuest curves are 1 (straight line at unity; even if you don't include 1, we'll add it back in) and 2. For all numbers > 1, you'll get a BoundariesGuest curve that approaches that value at higher DDI ratios, and, for the highest number you list, you'll additionally get straight line boundaries. This matches what is described in the BoundariesGuest Galetin 2011 paper. We recommend using only 1 and 2 as BoundariesGuest boundaries for clarity of the graph. |
boundary_color_set |
set of colors to use for indicating the X-fold
boundaries of the simulated / observed ratio. The default is "red black",
which, for the default boundaries, results in a black line at the 1.5-fold
boundary and a red one at the 2-fold boundary. Other options are "red
green", "muted red green" (a lighter, more muted red and green that work
well for indicating boundaries when you're using shading instead of lines),
and "black", which will result in only black lines or shading. You also can
set this to any set of colors you'd like, e.g., |
boundary_color_set_Guest |
set of colors to use for indicating the
X-fold boundaries of the simulated / observed ratio for DDI ratio graphs.
The default is "red black", which, for the default BoundariesGuest
boundaries, results in a black curved line and a red straight line at the
2-fold boundary. Other options are "red green", "muted red green" (a
lighter, more muted red and green that work well for indicating boundaries
when you're using shading instead of lines), and "black", which will result
in only black lines or shading. You also can set this to
any set of colors you'd like, e.g., |
boundary_line_types |
optionally specify the line types to use for the
boundaries (only applicable when |
boundary_line_types_Guest |
optionally specify the line types to use for
the DDI ratio graph boundaries (only applicable when
|
boundary_line_width |
line width; default is 0.7. This only applies when
|
error_bars |
Which error bars should be shown on the graph? Options are "none" (default), "simulated" to show vertical error bars ("vertical" also works in case that's easier to remember), "observed" ("horizontal" also works), or "both". |
variability_type |
If you're including error bars, what kind of
variability would you like to have those error bars display? Options are
"90
("SD" will also work fine), or "range". If |
point_color_column |
(optional) the column in |
point_color_set |
the set of colors to use for the points. Options:
|
legend_label_point_color |
optionally indicate on the legend something
explanatory about what the colors represent. For example, if
|
point_shape_column |
(optional) the column in |
point_shape |
optionally specify what shapes are used for the points.
Input should look like this, for example: |
point_size |
optionally specify the size of the points to use for the observed data. If left as NA, the size will be 2. |
point_transparency |
optionally specify how transparent to make the points. The default of 1 will make completely opaque points, and 0 would be completely transparent (invisible). |
legend_label_point_shape |
optionally indicate on the legend something
explanatory about what the colors represent. For example, if
|
legend_position |
Specify where you want the legend to be. Options are "left", "right" (default in most scenarios), "bottom", "top", or "none" if you don't want one at all. |
axis_title_x |
title for the x axis; default is "Observed" |
axis_title_y |
title for the y axis; default is "Simulated" |
include_dose_num |
Should the dose number be included? If set to TRUE, then the dose number part of the graph title, e.g., the "Dose 1" or "Last dose" part of "Dose 1 AUCinf" or "Last dose Cmax", will be included. If set to FALSE, those would be come "AUCinf" and "Cmax" only with no reference to which dose it was. If left as the default NA, then the dose number will be omitted if all the data are all for dose 1 or all for the last dose, and it will be included if you have a mix of dosing intervals. |
facet_title_size |
optionally specify what font size to use for the facet titles. If left as NA, a reasonable guess will be used. |
title_adjustments |
a character vector or list of text adjustments for the graph titles. Possible options:
|
all_intervals_together |
TRUE or FALSE (default) for whether to combine
all of a single type of PK parameter into a single graph. For example,
setting this to TRUE would put all the Cmax PK – regardless of whether it
was for the 1st dose, the last dose, or a custom interval – into a single
graph. The default, FALSE, means that anything that was its own column in
the PK summary table would also be its own graph here. NOTE: If you
do set this to TRUE, the shape of the points will be mapped to which
interval it is, which means that you can't also specify something
for the argument |
all_AUCs_together |
TRUE or FALSE (default) for whether to combine, e.g., AUCinf and AUCt for dose 1 into a single graph. Be careful with this because if you have points for both AUCinf and AUCt for a simulation, then BOTH of those points will show up on the graph. |
grid_color |
optionally specify the color of the major and minor grid lines on your graph. Default is "grey92", which is the standard grey for theme_bw() in ggplot2. Set this to "none" if you want no grid lines under your graph. |
ncol |
number of columns of graphs to show. If left as NULL (default), R will make a reasonable guess for the number. |
nrow |
number of rows of graphs to show. If left as NULL (default), R will make a reasonable guess for the number. |
save_graph |
optionally save the output graph by supplying a file name in quotes here, e.g., "My conc time graph.png" |
fig_width |
figure width in inches; default is 6 |
fig_height |
figure height in inches; default is 8 |
return_list_of_graphs |
TRUE or FALSE (default) for whether to return a list of each individual graph as its own separate ggplot2 object. |
axis_titles |
SOON TO BE DEPRECATED in favor of |
a set of arranged ggplot2 graphs
# Assuming you have run pk_table on a few files with observed data
# to generate an object called MyPKOutput, then:
so_graph(PKtable = SOdata)
so_graph(PKtable = SOdata, boundary_indicator = "fill")
so_graph(PKtable = SOdata,
axis_titles = c("y" = "Predicted", "x" = "Observed"))
so_graph(PKtable = SOdata, ncol = 1)
so_graph(PKtable = SOdata, point_shape_column = Study,
legend_position = "bottom")
so_graph(PKtable = SOdata,
point_shape_column = Study,
legend_label_point_shape = "Studies involving\nDrug X",
point_color_column = File,
legend_label_point_color = "Simulation file",
legend_position = "right")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.