View source: R/ggplotCSCurve.R
ggplotCSCurve | R Documentation |
ggplot
This function helps to plot the cell survival curves using
ggplot
, and is the recommended way to plot this curves
over plotCSCurve
. A single function plots the curves, both for
a single or multiple cell type(s), and allows most of the options necessary
to customize the figures for publication.
ggplotCSCurve( data, ..., method = "ml", PEmethod = "fit", colors = NULL, title = "", title_size = 20, title_color = "black", title_face = "bold", title_align = "center", subtitle = "", sub_size = 15, sub_color = "black", sub_face = "italic", sub_align = "center", xlab = "Dose (Gy)", xlab_size = 16, xlab_color = "black", xlab_face = "bold", rem_minor_x = "yes", emph_major_x = "no", major_x_col = "gray", major_x_width = 1, ylab = "Surviving Fraction", ylab_size = 16, ylab_color = "black", ylab_face = "bold", rem_minor_y = "yes", emph_major_y = "no", major_y_col = "gray", major_y_width = 1, legend_title = "", ltitle_size = 20, ltitle_color = "black", ltitle_face = "bold", ltitle_align = "left", legend_pos = "inside", legend_back = "", legend_border = "", legend_border_width = 0, ltext_size = 18, ltext_color = "black", ltext_face = "bold", xtext_size = 14, xtext_color = "black", xtext_face = "bold", ytext_size = 14, ytext_color = "black", ytext_face = "bold", point_shape = 16, point_size = 3.5, segment_type = 1, segment_width = 1, curve_width = 1.5, curve_type = 1, theme = ggplot2::theme_bw(), ylim = NULL, ybreaks = ggplot2::waiver(), save = "no", plot_width = 5, plot_height = 4, units = "in", save_path = getwd(), save_filename = "myplot.pdf" )
data |
A data frame containing at least the following five columns:
|
... |
The name of the cell type(s)/group(s). If entering multiple cell types, separate each by a comma. |
method |
Method used for the fit. It's |
PEmethod |
Controls the value of the plating efficiencies. The default
method, |
colors |
A vector of strings denoting the colors of the curves. Size of the vector should be equal to or more than the number of cell types entered. If no colors are chosen by the user, the function chooses them by random and they might change with each plotting. |
title |
A string denoting the title of the plot. Default is |
title_size |
An integer denoting the font size of the title. Default is
|
title_color |
A string denoting the color of the font of the title.
Default is |
title_face |
A string denoting the type of font face. Accepts
|
title_align |
A string denoting the justification (alignment) of the
plot title. Accepts |
subtitle |
A string denoting the subtitle of the plot; default is
|
sub_size, sub_color, sub_face, sub_align |
Used to customize the font size,
color, face, and alignment of the subtitle respectively, like the plot
title. Default values of these are |
xlab |
A string denoting the label of X-axis; default is |
xlab_size, xlab_color, xlab_face |
Used to customize the font size, color,
face, and alignment of the label of the X-axis respectively, like the plot
title. Default values of these are |
rem_minor_x |
If |
emph_major_x |
If |
major_x_col, major_x_width |
Allows the change of the color and width of
the major grids in the X-axis, when |
ylab |
A string denoting the label of y-axis; default is
|
ylab_size, ylab_color, ylab_face |
Used to customize the font size, color,
face, and alignment of the label of the Y-axis respectively, like the plot
title. Default values of these are |
rem_minor_y |
If |
emph_major_y |
If |
major_y_col, major_y_width |
Allows the change of the color and width of
the major grids in the Y-axis, when |
legend_title |
A string denoting the title of the legend; default is
|
ltitle_size, ltitle_color, ltitle_face, ltitle_align |
Used to customize
the font size, color, face, and alignment of the legend title respectively,
like the plot title. Default values of these are |
legend_pos |
A string denoting the position of the legend.
|
legend_back |
A string denoting the color of the legend background.
Default is |
legend_border |
A string denoting the color of the legnd border. Default
is |
legend_border_width |
An integer denoting the width of the legend
border. Default is |
ltext_size, ltext_color, ltext_face |
To change the font size, color, and
face of the legend texts. Default values of these are |
xtext_size, xtext_color, xtext_face |
To change the font size, color, and
face of x axis ticks.Default values of these are |
ytext_size, ytext_color, ytext_face |
To change the font size, color, and
face of y axis ticks. Default values of these are |
point_shape |
An integer denoting the shape of the points in the plot.
Default is |
point_size |
An integer denoting the size of the points in the plot.
Default is |
segment_type |
An integer denoting the type of the straight line
segments in the plot. Default is |
segment_width |
An integer denoting the width of straight line segments
in the plot. Default is |
curve_width |
An integer denoting the width of curved line segments in
the plot. Default is |
curve_type |
An integer denoting the type of curved line segments in the
plot. Default is |
theme |
The name of the theme to be used in the plot. It should be
preceded by the name of the package in the form: |
ylim |
A vector denoting the limits of the y-axis. Defaults are chosen
automatically by |
ybreaks |
A vector denoting the y-axis breaks/ticks. Defaults are chosen
automatically by |
save |
To save the plot. |
plot_width |
A number denoting the width of the plot. Default is
|
plot_height |
A number denoting the height of the plot. Default is
|
units |
A string denoting the units of the height and width of the plot
mentioned. Accepts |
save_path |
Path where the plot is to be saved. Default is the current
working directory obtained by |
save_filename |
File name with extension for the plot. Accepts most of
the common extensions, including |
A ggplot
object.
Please also refer to plotCSCurve
for regular plots.
datatab <- CASP8_data # Single curve ggplotCSCurve(datatab, "shCASP8-NT") ggplotCSCurve(datatab, "control-B", colors = "black", xlab = "X-axis", ylab = "Y-axis", title = "Single Plot", point_shape = 1, point_size = 2, segment_width = 1, segment_type = 1, curve_width = 1, curve_type = 1, legend_title = "Cell types", ylim = c(0.008, 1.05), ybreaks = c(0.01, 0.05, 0.20, 0.50, 1), theme = ggplot2::theme_classic()) # Multiple Curves ggplotCSCurve(datatab, "shCASP8-NT", "shCASP8-B", "shCASP8-B+Z", "shCASP8-B+Z+N") ggplotCSCurve(datatab, "shCASP8-NT", "shCASP8-B", "shCASP8-B+Z", "shCASP8-B+Z+N", colors = c("darkgreen", "green", "orange", "magenta"), xlab = "X-axis", ylab = "Y-axis", title = "Multiple Curves", point_shape = 15, point_size = 1, segment_width = 1, segment_type = 1, curve_width = 1, curve_type = 1, legend_title = "Cell types", theme = ggplot2::theme_dark(), legend_back = "white", legend_border = "white", legend_border_width = 0.5) ## Not run: # Save a plot ggplotCSCurve(datatab, "shCASP8-NT", "shCASP8-B", "shCASP8-B+Z", "shCASP8-B+Z+N", save = "yes") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.