uclahs-cds / package-BoutrosLab-plotting-general

Functions to Create Publication-Quality Plots
https://uclahs-cds.github.io/package-BoutrosLab-plotting-general
11 stars 4 forks source link

Add arrows in create.segplot #175

Open raagagrawal opened 7 months ago

raagagrawal commented 7 months ago

When creating a segplot where error bars might go out of bounds, I would like to add an arrow to one end of the line to indicate that it continues on out of sight.

pch currently only modifies the median character. I would want to modify the far right or left of the line.

Example code where a segplot is abruptly cut off...I would want the segplot for FOXO6 to have an arrow on the right hand side:

suppressPackageStartupMessages(library(BoutrosLab.plotting.general));
length.of.gene <- apply(microarray[1:10,60:61], 1, diff);
bin.length <- length.of.gene;
bin.length[which(bin.length < 20000)] <- 'A';
bin.length[which(bin.length < 40000)] <- 'B';
bin.length[which(bin.length < 60000)] <- 'C';

segplot.data <- data.frame(
    min = apply(microarray[1:10,1:58], 1, min),
    max = apply(microarray[1:10,1:58], 1, max),
    median = apply(microarray[1:10,1:58], 1, median),
    # Change to factor
    gene = as.factor(rownames(microarray)[1:10]),
    # approximating length of gene
    length = as.factor(bin.length)
    );

# Minimal Input using real data
create.segplot(
    # filename = tempfile(pattern = 'Segplot_Minimal_Input', fileext = '.tiff'),
    formula = gene ~ min + max,
    data = segplot.data,
    main = 'Minimal input',
    xlimits = c(0, 8),
    resolution = 100
    );