ct_plot_mult | R Documentation |
This function was designed for making nicely arranged
concentration-time graphs from several Simcyp Simulator output files all
together or for making multiple files – one for each Simulator file
– all at once. Behind the scenes, it uses the function ct_plot
to make these graphs, so it will automatically break up your supplied
concentration-time data into datasets by a) file, b) compound ID, c)
tissue, and d) tissue subtype for any ADAM- or brain-model data.
If you have more than one dataset per file, the graph titles won't
necessarily be clear, so please pay attention to what data you're
including. If you get unexpected or unclear output, try using
ct_plot_overlay
to graph your data; it might work better for
what you want to show. For detailed instructions and examples, please see
the SharePoint file "Simcyp PBPKConsult R Files - Simcyp PBPKConsult R
Files/SimcypConsultancy function examples and
instructions/Concentration-time plots 2 - multiple plots at
once/Concentration-time-plot-examples-2.docx". (Sorry, we are unable to
include a link to it here.)
A note on the order of the graphs: This function arranges graphs
first by file, then by compound ID, then by tissue, and then by tissue
subtype, and all sorting is alphabetical. However, since sorting
alphabetically might not be the optimal graph arrangement for your
scenario, you can specify the order of the graphs using either the
graph_titles
argument or, if you're comfortable with setting factors
in R, by making any of File, CompoundID, Tissue, and Tissue_subtype factor
rather than character data and setting the levels how you wish. If you're
unfamiliar with setting factor levels in R and setting graph_titles
isn't achieving what you want, please ask a member of the R Working Group
for assistance.
ct_plot_mult(
ct_dataframe,
obs_to_sim_assignment = NA,
graph_arrangement = "all together",
qc_graph = FALSE,
existing_exp_details = NA,
figure_type = "percentiles",
mean_type = "arithmetic",
linear_or_log = "semi-log",
time_range = NA,
x_axis_interval = NA,
x_axis_label = NA,
pad_x_axis = TRUE,
pad_y_axis = TRUE,
y_axis_limits_lin = NA,
y_axis_limits_log = NA,
y_axis_label = NA,
conc_units_to_use = NA,
hline_position = NA,
hline_style = "red dotted",
vline_position = NA,
vline_style = "red dotted",
legend_position = "none",
legend_orientation = NA,
legend_label = NA,
graph_titles = "none",
graph_title_size = 14,
graph_labels = TRUE,
prettify_compound_names = TRUE,
name_clinical_study = NA,
report_progress = FALSE,
save_graph = NA,
file_suffix = NA,
fig_height = 8,
fig_width = 8,
...
)
ct_dataframe |
the data.frame with multiple sets of concentration-time data |
obs_to_sim_assignment |
optionally specify which observed files should
be compared to which simulator files. If left as NA and what you supplied
for |
graph_arrangement |
set how to arrange the graphs. Options are
If you choose "separate files", each Simulator output file will have its
own graph file, named to match the Simulator output file name and you don't
need to specify anything for |
qc_graph |
TRUE or FALSE (default) on whether to create a second copy of
the graphical file(s) where the left panel shows the original graphs and
the right panel shows information about the file used to get the data and
the trial design. This works MUCH faster when you have already used
|
existing_exp_details |
output from |
figure_type |
type of figure to plot. Options are:
|
mean_type |
graph "arithmetic" (default) or "geometric" means or "median" for median concentrations |
linear_or_log |
the type of graph to be returned. Options: "semi-log" (default), "linear", "both vertical" (graphs are stacked vertically), or "both horizontal" (graphs are side by side). |
time_range |
time range to show relative to the start of the simulation. Options:
|
x_axis_interval |
optionally set the x-axis major tick-mark interval. Acceptable input: any number or leave as NA to accept default values, which are generally reasonable guesses as to aesthetically pleasing and PK-relevant intervals. |
x_axis_label |
optionally supply a character vector or an expression to use for the x axis label |
pad_x_axis |
optionally add a smidge of padding to the the x axis
(default is TRUE, which includes some generally reasonable padding). If
changed to FALSE, the y axis will be placed right at the beginning of your
time range and all data will end exactly at the end of the time
range specified. If you want a specific amount of x-axis padding,
set this to a number; the default is |
pad_y_axis |
optionally add a smidge of padding to the y axis (default
is TRUE, which includes some generally reasonable padding). As with
|
y_axis_limits_lin |
optionally set the Y axis limits for the linear
plot, e.g., |
y_axis_limits_log |
optionally set the Y axis limits for the semi-log
plot, e.g., |
y_axis_label |
optionally supply a character vector or an expression to use for the y axis label |
conc_units_to_use |
concentration units to use for graphs. If left as
NA, the concentration units in the source data will be used. Acceptable
options are "mg/L", "mg/mL", "µg/L" (or "ug/L"), "µg/mL" (or "ug/mL"),
"ng/L", "ng/mL", "µM" (or "uM"), or "nM". If you want to use a molar
concentration and your source data were in mass per volume units or vice
versa, you'll need to provide something for the argument
|
hline_position |
numerical position(s) of any horizontal lines to add to
the graph. The default is NA to have no lines, and good syntax if you
do want lines would be, for example, |
hline_style |
the line color and type to use for any horizontal lines
that you add to the graph with |
vline_position |
numerical position(s) of any vertical lines to add to
the graph. The default is NA to have no lines, and good syntax if you
do want lines would be, for example, |
vline_style |
the line color and type to use for any vertical lines that
you add to the graph with |
legend_position |
Specify where you want the legend to be. Options are "left", "right", "bottom", "top", or "none" (default) if you don't want one at all. If you include the legend but then some graphs do have a legend and some graphs do not (e.g., some have perpetrators and some do not so there's nothing to put in a legend), the alignment between sets of graphs will be a bit off. |
legend_orientation |
optionally specify how the legend entries should be oriented. Options are "vertical" or "horizontal", and, if left as NA, the legend entries will be "vertical" when the legend is on the left or right and "horizontal" when it's on the top or bottom. |
legend_label |
optionally indicate on the legend whether the perpetrator is an inhibitor, inducer, activator, or suppressor. Input will be used as the label in the legend for the line style and the shape. If left as the default NA when a legend is included and a perpetrator is present, the label in the legend will be "Inhibitor". |
graph_titles |
optionally specify titles to be used in the graphs and
specify the order in which the files are graphed or use "none" (default) to
have no titles on your graphs. Input should be a named character vector of
the files in the order you would like and what you want to use for the
title. The file name must perfectly match the file name listed in
ct_dataframe or it won't be used. An example of how this might be
specified: |
graph_title_size |
the font size for the graph title if it's included; default is 14. This also determines the font size of the graph labels. |
graph_labels |
TRUE (default) or FALSE for whether to include labels (A, B, C, etc.) for each of the small graphs. |
prettify_compound_names |
TRUE (default), FALSE or a character vector:
This is asking whether to make compound names prettier in legend entries
and in any Word output files. This was designed for simulations where the
substrate and any metabolites, perpetrators, or perpetrator metabolites are
among the standard options for the simulator, and leaving
|
name_clinical_study |
optionally specify the name(s) of the clinical
study or studies for any observed data. This only affects the caption of
the graph. For example, specifying |
report_progress |
TRUE or FALSE (default) for whether show a progress message on creating and saving graphs |
save_graph |
optionally save the output graph by supplying a file name
in quotes here, e.g., "My conc time graph.png"or "My conc time graph.docx".
If you leave off ".png" or ".docx", it will be saved as a png file, but if
you specify a different graphical file extension, it will be saved as that
file format. Acceptable graphical file extensions are "eps", "ps", "jpeg",
"jpg", "tiff", "png", "bmp", or "svg". Do not include any slashes, dollar
signs, or periods in the file name. Leaving this as NA means the file
will not be automatically saved to disk, except when |
file_suffix |
optionally add a file suffix to explain what each graph
it. For example, you might run this function once and with
|
fig_height |
figure height in inches; default is 8 |
fig_width |
figure width in inches; default is 8 |
... |
arguments that pass through to |
a set of arranged ggplot2 graphs and/or saved files of those graphs
data(MDZct)
ct_plot_mult(ct_dataframe = MDZct)
ct_plot_mult(ct_dataframe = MDZct,
graph_titles = c("mdz-5mg-sd-fa1.xlsx" = "fa = 1",
"mdz-5mg-sd-fa0_8.xlsx" = "fa = 0.8",
"mdz-5mg-sd-fa0_6.xlsx" = "fa = 0.6",
"mdz-5mg-sd-fa0_4.xlsx" = "fa = 0.4"))
# Graph titles when you have the tricky situation of more than one
# dataset per file
ct_plot_mult(
ct_dataframe = MDZ_Keto,
graph_titles = c("mdz-qd-keto-qd.xlsx.substrate.plasma.none" = "Midazolam in plasma",
"mdz-qd-keto-qd.xlsx.substrate.blood.none" = "Midazolam in blood",
"mdz-qd-keto-qd.xlsx.inhibitor 1.plasma.none" = "Ketoconazole in plasma",
"mdz-qd-keto-qd.xlsx.inhibitor 1.blood.none" = "Ketoconazole in blood"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.