Plotly is free for unlimited public use. Sign up for free!

Sensitive data? Upgrade to a paid plan

Show Sidebar Hide Sidebar

Getting Started with Plotly for Node.js

Plotly's Node.js graphing library makes interactive, publication-quality graphs online. Examples of how to make line plots, scatter plots, area charts, bar charts, error bars, box plots, histograms, heatmaps, subplots, multiple-axes, polar charts and bubble charts.

Getting started with Plotly for Nodejs


To install Plotly's Node module, use npm.

npm install plotly


Fire up Node!

$ node
var plotly = require('plotly')("DemoAccount", "lr1c37zw81")

You'll need to replace "DemoAccount" and "lr1c37zw81" with your Plotly username and API key.

Find my API key.

Special Instructions for Plotly On-Premise users

Your API key for account on the public cloud will be different than the API key in Plotly On-Premise. Visit to find your Plotly On-Premise API key. Remember to replace "" with the URL of your Plotly On-Premise server.

Instantiate your plotly object with the domain of your Plotly On-Premise server.

var plotly = require('plotly')({"username": "DemoAccount", "apiKey": "lr1c37zw81", "host": "", "port": 443})

Remember to replace "" with the URL of your Plotly On-Premise server. Questions?

Start plotting!

Copy and paste the following to create your first graph using the Plotly Node library! If all goes well, the URL for your graph will be printed in your console.

var data = [{x:[0,1,2], y:[3,2,1], type: 'bar'}];
var layout = {fileopt : "overwrite", filename : "simple-node-example"};

plotly.plot(data, layout, function (err, msg) {
	if (err) return console.log(err);

Still need help?
Contact Us

For guaranteed 24 hour response turnarounds, upgrade to a Developer Support Plan.