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 divlocale (
string()
) – String name of the locale (language) for Plotly (en-US
, orzh-CN
)
- PlotlyRenderManager.subplots(row, col, options)
Create subplots within figure field.
- Arguments
row (
number()
) – number of rows in subplot gridcol (
number()
) – number of columns in subplot gridoptions (
Object()
) – Axes Configuration Optionsoptions.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
x (
Array.
) – x-data arrayy (
Array.
) – y-data arrayoptions (
Object()
) – Line Graph Configuration Options (https://plotly.com/javascript/reference/scatter/)ax (
string()
) – Subplot to add line to. Default to last access axes.
- Returns
Object – The line plot object created.
- PlotlyRenderManager.scatter(x, y, options, ax="null")
Add scatter plot to figure
- Arguments
x (
Array.
) – x-data arrayy (
Array.
) – y-data arrayoptions (
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 arrayy (
Array.
) – average y-data arrayerrorY (
Array.
) – shaded y-data arrayoptions (
Object()
) – Scatter Graph Configuration Options (https://plotly.com/javascript/reference/scatter/)shadeOptions (
Object()
) – Shaded Area Configuration OptionsshadeOptions.color (
string()
) – #RRGGBB syntaxshadeOptions.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 arrayy (
Array.
) – y-data arrayz (
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
x (
Array.
) – x-data arrayoptions (
Object()
) – Scatter Graph Configuration Options (https://plotly.com/javascript/reference/scatter)ax (
string()
) – Subplot to add shaded area to. Default to last access axes.
- Returns
Object – The shaded error plot object created.
- PlotlyRenderManager.addText(x, y, text, options, ax="null")
Add text
- Arguments
x (
Array.
) – x positionsy (
Array.
) – y positionstext (
Array.
) – textsoptions (
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 arrayy (
Array.
) – y-data arrayoptions (
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 arrayy (
Array.
) – y-data arrayoptions (
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
options (
Object()
) – Color Axis Graph Configuration Options (https://plotly.com/javascript/reference/layout/coloraxis/#layout-coloraxis)
- Returns
string – The colorbar ID
- PlotlyRenderManager.setAxisProps(props, axis, ax="null")
Generic wrapper for changing axis Options
- Arguments
props (
Object()
) – axis configuration (https://plotly.com/javascript/reference/layout/xaxis/)axis (
string()
) – x or y axis to be configured.ax (
string()
) – Subplot to configure. Default to last access axes.
- PlotlyRenderManager.setLayoutProps(props)
Generic wrapper for changing layout Options
- Arguments
props (
Object()
) – axis configuration (https://plotly.com/javascript/reference/layout)
- 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
options (
Object()
) – Legend Configuration Options (https://plotly.com/javascript/reference/layout/#layout-legend)
- 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
, orlog
)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 textax (
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 valuesaxis (
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 valuesaxis (
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 textoptions (
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 textoptions (
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