bubble_plot: Create bubble plots

View source: R/bubble_plot.R

bubble_plotR Documentation

Create bubble plots

Description

Create bubble plots to have an indication of the quality of the lipid identification from MS-DIAL.

Usage

bubble_plot(data, x, y, color_by, carbon_db)

Arguments

data

Dataframe containing all information. See details for more information on the structure.

x

what to plot on the x-axis, in general retention time.

y

what to plot on the y-axis, in general m/z.

color_by

color the lines, in general the number carbons.

carbon_db

column containing the total carbon numer and total number of double bounds

Details

data should be data frame which contains at least all the parameters as columns.

Value

A ggplot2 plot is returned.

Author(s)

Rico Derks

Examples

my_data <- data.frame(rt = rep(c(seq(7, 10, length.out = 5),
                                 seq(3, 6, length.out = 3), 
                                 seq(2, 5, length.out = 7),
                                 seq(2, 8, length.out = 6),
                                 seq(5, 9, length.out = 4),
                                 seq(3, 10, length.out = 6)), 3),
                      mz = rep(seq(507, 510, by = 0.1), 3),
                      carbon = c(rep("43", 5), 
                                 rep("41", 3), 
                                 rep("44", 7), 
                                 rep("46", 6), 
                                 rep("42", 4), 
                                 rep("45", 6)),
                      carbon_db = c(paste0(rep("43", 5), ":", 5:1),
                      paste0(rep("41", 3), ":", 3:1),
                      paste0(rep("44", 7), ":", 7:1),
                      paste0(rep("46", 6), ":", 6:1),
                      paste0(rep("42", 4), ":", 4:1),
                      paste0(rep("45", 6), ":", 6:1)),
                      DotProduct = rnorm(n = 93, mean = 700, sd = 200),
                      LipidClass = c(rep("a", 31), rep("b", 31), rep("c", 31)))
# create the bubble plot
bubble_plot(data = my_data,
            x = rt,
            y = mz,
            color_by = carbon,
            carbon_db = carbon_db)

ricoderks/Rcpm documentation built on May 18, 2022, 7:49 a.m.