Plotly Wrapper Documentation

Overview

The Plotly graphing utility contain a series of wrapping function to simplify Plotly.js’s syntax.

Methods

class PlotlyRenderManager(divName, locale)

Create a Plotly Manager object for specific div on HTML.

Arguments
  • divName (string()) – String Name of the div

  • locale (string()) – String name of the locale (language) for Plotly (en-US, or zh-CN)

PlotlyRenderManager.subplots(row, col, options)

Create subplots within figure field.

Arguments
  • row (number()) – number of rows in subplot grid

  • col (number()) – number of columns in subplot grid

  • options (Object()) – Axes Configuration Options

  • options.sharex (bool()) – Each column share the same x-axis (default false)

  • options.sharey (bool()) – Each row share the same y-axis (default false)

  • options.colSpacing (bool()) – Spacing between each subplots on the same row (default 0.02)

  • options.rowSpacing (bool()) – Spacing between each subplots on the same column (default 0.15)

Returns

Array.<string> – Array of subplots created, C-ordered.

PlotlyRenderManager.getAxes()

Get the subplot array from Manager Cache.

Returns

Array.<string> – Array of subplots created, C-ordered.

PlotlyRenderManager.clearData()

Clear all traces

PlotlyRenderManager.plot(x, y, options, ax="null")

Add line plot to figure

Arguments
Returns

Object – The line plot object created.

PlotlyRenderManager.scatter(x, y, options, ax="null")

Add scatter plot to figure

Arguments
  • x (Array.) – x-data array

  • y (Array.) – y-data array

  • options (Object()) – Scatter Graph Configuration Options (https://plotly.com/javascript/reference/scatter/)

  • ax (string()) – Subplot to add scatter plot to. Default to last access axes.

Returns

Object – The line plot object created.

PlotlyRenderManager.shadedErrorBar(x, y, errorY, options, shadeOptions, ax)

Add shaded error plot to figure

Arguments
  • x (Array.) – x-data array

  • y (Array.) – average y-data array

  • errorY (Array.) – shaded y-data array

  • options (Object()) – Scatter Graph Configuration Options (https://plotly.com/javascript/reference/scatter/)

  • shadeOptions (Object()) – Shaded Area Configuration Options

  • shadeOptions.color (string()) – #RRGGBB syntax

  • shadeOptions.alpha (number()) – fractional alpha value from 0 to 1.

  • ax (string()) – Subplot to add line to. Default to last access axes.

PlotlyRenderManager.surf(x, y, z, options, ax="null")

Add heatmap (image) plot to figure

Arguments
  • x (Array.) – x-data array

  • y (Array.) – y-data array

  • z (Array.) – z-data array (size x,y)

  • options (Object()) – Heatmap Graph Configuration Options (https://plotly.com/javascript/reference/heatmap)

  • ax (string()) – Subplot to add heatmap to. Default to last access axes.

Returns

Object – The shaded error plot object created.

PlotlyRenderManager.addShadedArea(x, options, ax="null")

Add shaded area to figure

Arguments
Returns

Object – The shaded error plot object created.

PlotlyRenderManager.addText(x, y, text, options, ax="null")

Add text

Arguments
  • x (Array.) – x positions

  • y (Array.) – y positions

  • text (Array.) – texts

  • options (Object()) – Text Configuration Options (https://plotly.com/javascript/reference/text/)

  • ax (string()) – Subplot to add scatter plot to. Default to last access axes.

Returns

Object – The line plot object created.

PlotlyRenderManager.bar(x, y, options, ax="null")

Add bar plot to figure

Arguments
  • x (Array.) – x-data array

  • y (Array.) – y-data array

  • options (Object()) – Bar Graph Configuration Options (https://plotly.com/javascript/reference/bar)

  • ax (string()) – Subplot to add bar to. Default to last access axes.

Returns

Object – The shaded error plot object created.

PlotlyRenderManager.box(x, y, options, ax="null")

Add box plot to figure

Arguments
  • x (Array.) – x-data array

  • y (Array.) – y-data array

  • options (Object()) – Box Graph Configuration Options (https://plotly.com/javascript/reference/box)

  • ax (string()) – Subplot to add box to. Default to last access axes.

Returns

Object – The shaded error plot object created.

PlotlyRenderManager.clearAxes(ax)

Call to clear axis trends

PlotlyRenderManager.createColorAxis(options)

Add colorbar to figure

Arguments
Returns

string – The colorbar ID

PlotlyRenderManager.setAxisProps(props, axis, ax="null")

Generic wrapper for changing axis Options

Arguments
PlotlyRenderManager.setLayoutProps(props)

Generic wrapper for changing layout Options

Arguments
PlotlyRenderManager.setLegend(options)

Add legend to figure. Unlike other language, Plotly legend configuration is to configure appearance. Actual text is added in each plot trace’s option.

Arguments
Returns

string – The colorbar ID

PlotlyRenderManager.setScaleType(type, axis, ax="null")

Change axis scale.

Arguments
  • type (string()) – String name of the scale type for axis (linear, or log)

  • axis (string()) – x or y axis to be configured.

  • ax (string()) – Subplot to configure. Default to last access axes.

PlotlyRenderManager.setSubtitle(subtitle, ax="null")

Add title to figure.

Arguments
  • subtitle (string()) – Title text

  • ax (string()) – Subplot to add subtitle to. Default to last access axes.

PlotlyRenderManager.setTickLabel(labels, axis, ax="null")

Change axis ticks label.

Arguments
  • labels (Array.) – custom labels of the ticks. Same size as tick values

  • axis (string()) – x or y axis to be configured.

  • ax (string()) – Subplot to configure. Default to last access axes.

PlotlyRenderManager.setTickValue(values, axis, ax="null")

Change axis ticks location.

Arguments
  • values (Array.) – array of tick values

  • axis (string()) – x or y axis to be configured.

  • ax (string()) – Subplot to configure. Default to last access axes.

PlotlyRenderManager.setTitle(title)

Add title to figure.

Arguments
  • title (string()) – Title text

PlotlyRenderManager.setXlabel(title, options, ax)

Add X-axis Label to figure.

Arguments
  • title (string()) – Label text

  • options (Object()) – axis configuration (TODO) (https://plotly.com/javascript/reference/layout/xaxis/)

  • options.fontSize (Object()) – Text Font Size (default = 15)

  • ax (string()) – Subplot to add label to. Default to last access axes.

PlotlyRenderManager.setXlim(xlim, ax="null")

Change x-axis limits.

Arguments
  • xlim (Array.) – [min max] of x-axis limits.

  • ax (string()) – Subplot to configure. Default to last access axes.

PlotlyRenderManager.setYlabel(title, options, ax)

Add Y-axis Label to figure.

Arguments
  • title (string()) – Label text

  • options (Object()) – axis configuration (TODO) (https://plotly.com/javascript/reference/layout/yaxis/)

  • options.fontSize (Object()) – Text Font Size (default = 15)

  • ax (string()) – Subplot to add label to. Default to last access axes.

PlotlyRenderManager.setYlim(ylim, ax="null")

Change y-axis limits.

Arguments
  • ylim (Array.) – [min max] of y-axis limits.

  • ax (string()) – Subplot to configure. Default to last access axes.

PlotlyRenderManager.render()

Call to update figure or initial render

PlotlyRenderManager.refresh()

Call to update figure

PlotlyRenderManager.purge()

Call to clear figure