barplotFromNamedVector: Plot a barplot from a named vector

Description Usage Arguments Details Value Examples

View source: R/plottingFunctions.R

Description

Plot a barplot from a named vector

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
barplotFromNamedVector(
  data,
  colorsForGraphs = NULL,
  orderForCategory1 = NULL,
  legend = T,
  putLegendToTheTopRightBorder = T,
  args.legend = list(x = "topright", inset = c(-0.2, 0), bg = "white"),
  las = 2,
  ...
)

Arguments

data

a named vector where values are number and names are category1(which can have dot).category2(no dot possible here)

colorsForGraphs

a named vector with the colors which should be used in the barplot (names should correspond to category2)

orderForCategory1

a vector with the names of the category1 in the order it should be plotted

legend

a logical to precise if the legend should be added (default is TRUE)

putLegendToTheTopRightBorder

a logical to precise if the legend should be until the extremity of the page (default is TRUE)

args.legend

list of arguments for the legend (default is topright inset=(-0.2, 0), bg= "white")

las

a numeric value between 0 and 3 to specify the style of axis label (default is 2)

...

other arguments for barplot

Details

Will plot a barplot with one bar per category1

Value

invisible x values for the barplot

Examples

1
2
3
4
5
6
7
8
9
topTs <- c(5, 10, 15, 20) * 1e3
colorsForGraphs<-grDevices::rainbow(2+length(topTs))
names(colorsForGraphs)<-c(paste0("overlapTop",sort(topTs/1e3),"k"),"overlap","specific")
v <- c(15809, rep(5000, 4), c(9316, 4762, 4327, 3831, 5051, 36638))
names(v) <- paste(c(rep("ChIP1", 5), rep("ChIP2", 6)),
                 c(rep(paste0("overlap", c("", "Top5k", "Top10k", "Top15k", "Top20k")), 2),
                   "specific"),
                 sep = ".")
barplotFromNamedVector(v, colorsForGraphs = colorsForGraphs)

lldelisle/analysePeaks documentation built on July 10, 2021, 1:02 p.m.