Skip to content

style_plot

Description

Styles a plot with provided colors and labels

Usage

style_plot(
p,
title = NULL,
xlabel = NULL,
ylabel = NULL,
xlims = NULL,
ylims = NULL,
colors = NULL,
labels = NULL,
shapes = NULL,
legend = NULL,
shape_legend = NULL,
color_order = NULL,
shape_order = NULL,
linetype_order = NULL,
legend.position = NULL,
legend.title.position = NULL,
legend.title.hjust = NULL,
logx = NULL,
logy = NULL,
fill_alpha = NULL,
fill_legend = NULL,
fill_order = NULL,
caption_hjust = NULL,
legend_nrow = NULL
)

Arguments

NameDescription
pa ggplot2 object to update colors/legend labels
titlea string for a plot title
xlabela string for x-axis label
ylabela string for y-axis label
xlimsa tuple of numbers specifying limits for x-axis
ylimsa tuple of numbers specifying limits for y-axis
colorsa named character vector for setting colors
labelsa named character vector for setting legend labels
shapesa named character vector for setting geom_point shapes
legenda string for setting color legend title
shape_legenda string for setting shape legend title
color_ordera numeric for setting color legend order
shape_ordera numeric for setting shape legend order
linetype_ordera numeric for setting linetype legend order
legend.positiona string for legend position
legend.title.positiona string for legend title position (“top”, “left”, “bottom”, “right”)
legend.title.hjusta string or numeric for legend title horizontal justification (“left”/0, “center”/0.5, “right”/1)
logxa boolean for setting x-axis to log scale
logya boolean for setting y-axis to log scale
fill_alphaa numeric for controlling alpha of fill colors
fill_legenda string to replace fill legend title
fill_ordera numeric for setting fill legend order
caption_hjusta string or numeric for caption horizontal justification (“left”/0, “center”/0.5, “right”/1)
legend_nrowa numeric for number of rows in legend

Returns

an updated ggplot2 object

Examples

data_proc <- data |> preprocess()
.p <- eda_mean_dv_over_time(
data_proc,
deltaQTCF,
NTLD,
DOSEF,
group_col = TRTG,
reference_threshold = c(-10, 10),
)
.p <- style_plot(
p = .p,
colors = c(
"0 mg Placebo" = "grey"
),
labels = c(
"120 mg Verapamil HCL" = "Verapamil",
"0 mg Placebo" = "Placebo",
"Reference 10" = "+/- 10 ms dQTcF",
"Reference -10" = NA
),
legend = "Treatment"
)
.p