Home

Awesome

Plotly.jl

Build Status

A Julia interface to the plot.ly plotting library and cloud services

<div align="center"> <a href="https://dash.plotly.com/project-maintenance"> <img src="https://dash.plotly.com/assets/images/maintained-by-community.png" width="400px" alt="Maintained by the Plotly Community"> </a> </div>

Install

Simply run Pkg.add("Plotly").

Usage

Plotting functions provided by this package are identical to PlotlyJS. Please consult its documentation. In fact, the package depends on PlotlyJS.jl and reexports all the methods.

For example, this will display a basic scatter plot:

my_plot = plot([scatter(x=[1,2], y=[3,4])], Layout(title="My plot"))

Using the Plotly cloud

New user signup

Find your username and API key in the Plotly settings.

Signin

julia> Plotly.signin("username","your api key")
PlotlyAccount("username","your api key")

Note: you may also specify your session endpoints using sign in as follows:

julia> Plotly.signin("username","your api key",Dict("plotly_domain"=> "your_plotly_base_endpoint", "plotly_api_domain"=> "your_plotly_api_endpoint"))

Saving your credentials

julia> Plotly.set_credentials_file(Dict("username"=>"your_user_name","api_key"=>"your_api_key"))

Note: your credentials will be saved within /YOUR_HOME_DIR/.plotly/.credentials

Saving your endpoint configuration

julia> Plotly.set_config_file(Dict("plotly_domain"=> "your_plotly_base_endpoint", "plotly_api_domain"=> "your_plotly_api_endpoint"))

Note: your configuration will be saved within /YOUR_HOME_DIR/.plotly/.config

Saving a plot to the cloud

Use the post function to upload a local plot to the Plotly cloud:

> my_plot  = plot([scatter(y=[1,2])])
> remote_plot = post(my_plot)
Plotly.RemotePlot(URI(https://plot.ly/~malmaud/73))

Visiting https://plot.ly/~malmaud/73 in a browser will show the plot.

Download a plot from the cloud

Use the download function with a remote plot object to download a plot stored on the Plotly cloud to a local Plot object:

local_plot = download(RemotePlot("https://plot.ly/~malmaud/73"))
# or equivalently, local_plot = download_plot("https://plot.ly/~malmaud/73")

Working with plotlyjs() backend of Plots.jl

A plot created by Plots.jl with plotlyjs() backend has the type Plot{Plots.PlotlyJSBackend()}. To use the Plotly.jl interfeces, the plot object needs to be converted by

my_plot = Plots.plotlyjs_syncplot(plots_plot)

The object my_plot can be handed to the Cloud API descrived above.

Acknowledgements

PlotlyJS.jl , which provides the large majority of the functionality of this package, is developed primarily by Spencer Lyon.

This package, which adds to PlotlyJS.jl the functionality for interacting with the Plotly cloud, is developed by Jon Malmaud and others.

Contribute

Please do! This is an open source project. Check out the issues or open a PR!

We want to encourage a warm, welcoming, and safe environment for contributing to this project. See the code of conduct for more information.

License

MIT © 2016-2017 Shilei Zheng, Leah Hanson, Bryan A. Knowles, Chris Palmer, Jon Malmaud