plotLength: Plot fragment length profile

View source: R/plotLength.R

plotLengthR Documentation

Plot fragment length profile

Description

Plot fragment length profile

Usage

plotLength(
  x,
  plot_type = c("Fraction"),
  xlim = c(30, 500),
  ylim = NULL,
  x_breaks,
  x_labels,
  vline,
  add_vline = TRUE,
  line_color = "grey1",
  line_size = 0.6,
  line_alpha = 0.8,
  vline_color = "grey",
  vline_type = "dashed",
  vline_size = 0.7,
  area_highlight = NULL,
  output_file = NULL,
  ggsave_params = list(width = 10, height = 11, dpi = 500, bg = "white", unit = "cm"),
  ...
)

Arguments

x

Data to be plotted.

plot_type

Type of plot to generate (e.g., 'count' or 'fraction').

xlim

Limits for the x-axis.

ylim

Limits for the y-axis.

x_breaks

Breaks for the x-axis.

x_labels

Labels for the x-axis.

vline

Position of vertical lines.

add_vline

Logical, whether to add vertical lines.

line_color

Color of the plot lines.

line_size

Size of the plot lines.

line_alpha

Transparency of the plot lines.

vline_color

Color of the vertical lines.

vline_type

Type of the vertical lines (e.g., 'dashed').

vline_size

Size of the vertical lines.

area_highlight

List specifying areas to highlight; each list element is a sublist specifying 'range', 'fill', and 'alpha'.

output_file

File path and name for saving the output plot. Ensure the directory exists and is writable.

ggsave_params

A list of parameters for ggplot2::ggsave(). May include 'width', 'height', 'dpi', etc. Use named elements in the list to specify.

...

Additional parameters for the plotting function.

Value

A ggplot2 object that can be further modified or saved.

Examples

# Assuming 'data' is a dataframe with 'insert_size' and 'value' columns:
plotLength(data, plot_type = "fraction", xlim = c(100, 500), ylim = c(0, 1),
           x_breaks = seq(100, 500, by = 50), add_vline = TRUE, vline = 150)

hw538/cfDNAPro documentation built on Feb. 17, 2025, 6:09 p.m.