Bar Chart

A barplot shows the relationship between a numeric and a categoric variable. Each entity of the categoric variable is represented as a bar. The size of the bar represents its numeric value. Barplot is sometimes described as a boring way to visualize information. However it is probably the most efficient way to show this kind of data. Ordering bars and providing good annotation are often necessary.



Color Themes


{
   "y" : {
      "data" : [
        [33,44,55]
      ],
      "smps" : ["S1","S2","S3"],
      "vars" : ["V1"]
   }
}
{
   "decorations" : {
      "marker" : [{"fontSize" : 12,"sample" : "S1","text" : "p < 0.01 ***","type" : "annotation","variable" : "V1"},{"fontSize" : 12,"sample" : "S2","text" : "p < 0.05 **","type" : "annotation","variable" : "V1"},{"fontSize" : 12,"sample" : "S2","sample2" : "S3","text" : "p < 0.01 ***","type" : "comparison","variable" : "V1","variable2" : "V1"}]
   },
   "graphOrientation" : "vertical",
   "graphType" : "Bar",
   "showLegend" : "false",
   "smpLabelRotate" : "90",
   "smpTitle" : "Samples",
   "theme" : "CanvasXpress",
   "title" : "Simple Bar graph with annotations",
   "xAxisTitle" : "Value"
}
library(canvasXpress)
y=read.table("https://www.canvasxpress.org/data/cX-basic-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
canvasXpress(
  data=y,
  decorations=list(marker=list(list(fontSize=12, sample="S1", text="p < 0.01 ***", type="annotation", variable="V1"), list(fontSize=12, sample="S2", text="p < 0.05 **", type="annotation", variable="V1"), list(fontSize=12, sample="S2", sample2="S3", text="p < 0.01 ***", type="comparison", variable="V1", variable2="V1"))),
  graphOrientation="vertical",
  graphType="Bar",
  showLegend=FALSE,
  smpLabelRotate=90,
  smpTitle="Samples",
  theme="CanvasXpress",
  title="Simple Bar graph with annotations",
  xAxisTitle="Value"
)