Black Lives Matter. Please consider donating to Black Girls Code today.

Getting Started with Plotly in Julia

Plotly's Julia 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: Plotly for Julia


Install using Julia's Pkg module. From the Julia REPL:



In the Julia console, begin by importing the Plotly Julia library.

using Plotly


Next, set your Plotly user credentials.

It is also possible to save your user credentials for future Julia sessions. In your Julia terminal, enter:


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

Find my API key.

You only have to set this up if it's your first time using a Plotly API.

Special Instructions for Chart Studio Enterprise users

If your company has a Chart Studio Enterprise server, change the API endpoint so that it points to your company's Plotly server instead of Plotly's cloud.

In your Julia console, enter:

Plotly.set_config_file({"plotly_domain"=>"", "plotly_api_domain"=>""})

Make sure to replace "" with the URL of your Chart Studio Enterprise server.Questions?

Start plotting!

Now you can make a simple API call using Plotly.plot(), and create your first graph!

trace1 = [
  "x" => [1, 2, 3, 4],
  "y" => [10, 15, 13, 17],
  "type" => "scatter"
trace2 = [
  "x" => [1, 2, 3, 4],
  "y" => [16, 5, 11, 9],
  "type" => "scatter"

response = Plotly.plot([trace1, trace2], ["filename" => "basic-line", "fileopt" => "overwrite"])
plot_url = response["url"]


Here is the response you'll receive (copy and paste the URL into your browser to see your graph!)



The initialization step places a special .plotly/.credentials file in your home directory. Your ~/.plotly/.credentials file should look something like this:

    "username": "DemoAccount",
    "stream_ids": ["ylosqsyet5", "h2ct8btk1s", "oxz4fm883b"],
    "api_key": "lr1c37zw81"

You can change the contents of this file manually or as described in the Initialization section.