JavaScript Library

Include the CanvasXpress JavaScript library in the <head></head> of your web page.

<link rel="stylesheet" href="path-to-canvasXpress.css" type="text/css"/>
<script type="text/javascript" src="path-to-canvasXpress.min.js"></script>

Any code as decribed below should be placed in a <script></script> tag.

Plot basics

All cxplot plots begin with a call to var cxp = cxplot(), supplying a DOM target id to place the visualization, a default data and aesthethic mappings, specified by aes(). You can also supply an additional parameter with custom events. You then add layers, scales, coords and facets with cxp.

Create a new cxplot
Construct aesthetic mappings

Layers

Geoms

A layer combines data, aesthetic mapping, a geom (geometric object), a stat (statistical transformation), and a position adjustment. Typically, you will create layers using a geom_ function, overriding the default position and stat if needed.

Reference lines: horizontal, vertical, and diagonal

Heatmap of 2d bin counts

A box and whiskers plot (in the style of Tukey)

Smoothed density estimates

Dot plot

Horizontal error bars

Hexagonal heatmap of 2d bin counts

Histograms and frequency polygons

Jittered points

Connect observations

Points

Quantile regression

Ribbons and area plots

Rug plots in the margins

Smoothed conditional means

Rectangles

Scales

Scales control the details of how data values are translated to visual properties. Override the default scales to tweak details like the axis labels or legend keys, or to use a completely different translation from data to aesthetic. labs() and lims() are convenient helpers for the most common adjustments to the labels and limits.

Set scale limits

Modify axis, legend, and plot labels

Facetting

Facetting generates small multiples, each displaying a different subset of the data. Facets are an alternative to aesthetics for displaying additional discrete variables.

Wrap a 1d ribbon of panels into 2d

Themes

Themes control the display of all non-data elements of the plot.

Modify components of a theme