ct_plot | R Documentation |
Using observed and simulated concentration-time data generated
from the function extractConcTime
, make publication-quality
graphs that comply with the Simcyp Consultancy Team's standards. We've
tried to include a fair number of options here for flexibility, but many of
the function arguments are optional; most of the time, you'll get
decent-looking graphs while only setting a minimal number of arguments.
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 1 - one sim at a time/Concentration-time-plot-examples-1.docx". (Sorry, we are unable to include a link to it here.)
A few notes:
Not all substrate metabolites, inhibitors, or inhibitor metabolites are available in all tissues. If it's not present in your output, we can't graph it here.
If you have observed concentration-time data to match your simulated data
but you don't see those observed data on your graph, please check the help
file for the function you used – either extractConcTime
or
extractConcTime_mult
– to extract your data. Something has
likely gone wrong in the data extraction.
If you attempt to use data generated by
extractConcTime_mult
here, you can get weird results if you're
not careful to include only one tissue and one compound. If you see
something odd, try including the legend with, e.g., legend_position =
"right"
to help decipher what might have gone awry. It can also be
informative to use the function ct_plot_overlay
to make a
draft version of your graph because that function will give you some messages
about what data are included.
If you want to plot enzyme abundance data, please see
enz_plot
or enz_plot_overlay
.
ct_plot(
ct_dataframe = NA,
figure_type = "percentiles",
Tissue_subtype = NA,
mean_type = "arithmetic",
time_range = NA,
x_axis_interval = NA,
x_axis_label = NA,
time_units_to_use = NA,
pad_x_axis = TRUE,
pad_y_axis = TRUE,
adjust_obs_time = FALSE,
t0 = "simulation start",
y_axis_limits_lin = NA,
y_axis_limits_log = NA,
y_axis_interval = NA,
y_axis_label = NA,
conc_units_to_use = NA,
obs_color = NA,
obs_shape = NA,
obs_size = NA,
obs_fill_trans = NA,
obs_line_trans = NA,
connect_obs_points = FALSE,
obs_on_top = TRUE,
include_errorbars = FALSE,
errorbar_width = 0.5,
showBLQ = FALSE,
line_type = NA,
line_transparency = NA,
line_color = NA,
line_width = NA,
hline_position = NA,
hline_style = "red dotted",
vline_position = NA,
vline_style = "red dotted",
legend_position = "none",
legend_orientation = NA,
legend_label = NA,
prettify_compound_names = TRUE,
linear_or_log = "both vertical",
graph_labels = TRUE,
graph_title = NA,
graph_title_size = 14,
qc_graph = FALSE,
existing_exp_details = NA,
return_caption = FALSE,
name_clinical_study = NA,
save_graph = NA,
fig_height = NA,
fig_width = NA,
subsection_ADAM = "deprecated"
)
ct_dataframe |
the input concentration-time data generated by running
the function |
figure_type |
type of figure to plot. Options are:
|
Tissue_subtype |
Certain types of models have additional subtypes of tissues. Currently, the SimcypConsultancy package supports ADAM-model and brain-compartment tissue subtypes. In these scenarios, it's not sufficient to say "colon" or "brain" because those tissues have multiple subtypes. This is where you can specify which you want. Default is "free compound in lumen" but is ignored when ct_dataframe doesn't contain ADAM data. |
mean_type |
graph "arithmetic" (default) or "geometric" means or "median" for median concentrations. If that option was not included in the output, you'll get a warning and the graph will include one that was. |
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 |
time_units_to_use |
time units to use for graphs. If left as NA, the time units in the source data will be used. Options are "hours", "minutes", "days", or "weeks". |
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
|
adjust_obs_time |
TRUE or FALSE (default) for whether to adjust the time listed in the observed data file to match the last dose administered. This only applies to multiple-dosing regimens. If TRUE, the graph will show the observed data overlaid with the simulated data such that the dose in the observed data was administered at the same time as the last dose in the simulated data. If FALSE, the observed data will start at whatever times are listed in the Excel file. |
t0 |
What event should be used for time zero? Options are: "simulation start" (default), "dose 1", "penultimate dose", or "last dose". This does not change which data are included in the graph; instead, this determines whether the x axis numbers are offset so that, e.g., the last dose is administered at time 0. |
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_interval |
set the linear y-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 intervals. |
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
|
obs_color |
If you would like the observed data points to be in color,
either specify a color here or leave this as NA to get all black points for
most graph types or, if you set something for
|
obs_shape |
optionally specify what shapes are used to depict observed
data for 1. the substrate drug alone and 2. the substrate drug in the
presence of a perpetrator. Input should look like this, for example:
|
obs_size |
optionally specify the size of the points to use for the observed data. If left as NA, the size will be 2. |
obs_fill_trans |
optionally specify the transparency for the fill of the
observed data points, which can be helpful when you have a lot of points
overlapping. This only applies when you have specified a value for
|
obs_line_trans |
optionally specify the transparency for the outline of the observed data points, which can be helpful when you have a lot of points overlapping. Acceptable values are from 0 (fully transparent, so no line at all) to 1 (completely opaque or black). If left as the default NA, the observed data points will be opaque, so the same as if this were set to 1. |
connect_obs_points |
TRUE or FALSE (default) for whether to add connecting lines between observed data points from the same individual |
obs_on_top |
TRUE (default) or FALSE for whether to show the observed data on top of the simulated data. If FALSE, the simulated data will be on top. |
include_errorbars |
TRUE or FALSE (default) for whether to include error bars for observed data points. This ONLY applies when you have supplied observed data from V22 or higher because those data files included a column titled "SD/SE", which is what we'll use for determining the error bar heights. |
errorbar_width |
width of error bars to use in hours (or, if you've used some other time unit, in whatever units are in your data). Default is 0.5. |
showBLQ |
TRUE or FALSE (default) to display observed concentrations that were clearly below the lower limit of quantitation, that is, concentrations equal to 0 after time 0. The default (FALSE) removes these values so that they will not show up on graphs. |
line_type |
Optionally specify what types of lines are used to depict
Input should look like
this, for example:
|
line_transparency |
optionally specify the transparency for the trial mean or percentile lines. Acceptable values are from 0 (fully transparent, so no line at all) to 1 (completely opaque or black). If left as the default NA, this value will be automatically determined. |
line_color |
optionally specify what colors to use for the lines.
Acceptable input for, e.g., the substrate alone to be blue and the
substrate + Inhibitor 1 to be red: |
line_width |
optionally specify how thick to make the lines. Acceptable input is a number; the default is 1 for most lines and 0.8 for some, to give you an idea of where to start. |
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. |
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". |
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
|
linear_or_log |
the type of graph to be returned. Options:
|
graph_labels |
TRUE or FALSE for whether to include labels (A, B, C, etc.) for each of the small graphs. (Not applicable if only outputting linear or only semi-log graphs.) |
graph_title |
optionally specify a title that will be centered across your graph or set of graphs |
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. |
qc_graph |
TRUE or FALSE (default) on whether to create a second copy of
the graph where the left panel shows the original graph and the right panel
shows information about the simulation trial design. This works MUCH faster
when you have already used |
existing_exp_details |
output from |
return_caption |
TRUE or FALSE (default) for whether to return any
caption text to use with the graph. This works best if you supply something
for the argument |
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 |
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". The nice thing about saving to Word is that the figure title and caption text will be filled in automatically. If you leave off ".png" or ".docx", the graph 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 saved to disk. |
fig_height |
figure height in inches |
fig_width |
figure width in inches |
subsection_ADAM |
SOON TO BE DEPRECATED. We have now added non-ADAM-model tissues to the subtypes of tissues you can extract from Simulator output, so the old "subsection_ADAM" name we had used for which subtype of tissue it was no longer works as well. Please use "Tissue_subtype" instead going forward. |
study_design_matches_obs |
optionally specify whether the study design for the simulated data matched that of any observed data. This only affects the caption of the graph. If set to TRUE, this assumes that the number of subjects in the clinical study matches the number of subjects per trial in the simulated data. |
Output is a ggplot2 graph or two ggplot2 graphs arranged with ggpubr::ggarrange()
# Load some concentration-time data to play with:
data(LMVct)
ct_plot(ct_dataframe = LMVct)
ct_plot(ct_dataframe = LMVct, figure_type = "percentiles")
ct_plot(ct_dataframe = LMVct)
ct_plot(ct_dataframe = LMVct)
# Perhaps you don't want to show *all* the data but instead want to
# limit the time interval that is graphed. Use `time_range` here:
ct_plot(ct_dataframe = LMVct, time_range = c(0, 24))
# Or you can let it automatically calculate the time frame
# for a given set of doses
ct_plot(ct_dataframe = LMVct
time_range = "first dose")
ct_plot(ct_dataframe = LMVct,
time_range = "last dose")
# The default graph may be too busy when Inhibitor 1 is present,
# so you may want to consider only plotting means as an alternative:
ct_plot(ct_dataframe = LMVct,
figure_type = "means only")
# Add some further options for the look of your graph -- especially useful
# if the default settings are clipping your data.
ct_plot(ct_dataframe = LMVct,
obs_color = "red",
line_color = "blue",
y_axis_limits_log = c(50, 2000),
pad_x_axis = TRUE,
legend_label = "Inhibitor")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.