Histogram Chart

A histogram takes as input a numeric variable only. The variable is cut into several bins, and the number of observation per bin is represented by the height of the bar. It is possible to represent the distribution of several variable on the same axis using this technique.



Color Themes


{
   "graphType" : "Scatter2D",
   "histogramType" : "dodged",
   "segregateVariablesBy" : ["dataset"]
}
var cX = CanvasXpress.$("canvasId");
cX.createHistogram();
library(canvasXpress)
y=read.table("https://www.canvasxpress.org/data/cX-datasaurus-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
z=read.table("https://www.canvasxpress.org/data/cX-datasaurus-var.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
canvasXpress(
  data=y,
  varAnnot=z,
  graphType="Scatter2D",
  histogramType="dodged",
  segregateVariablesBy=list("dataset"),
  afterRender=list(list("createHistogram"))
)