Preliminaries

Basics

plotly.js figures are constructed by calling the function:

Plotly.newPlot(graphdiv, data, layout)

where

  • graphdiv is an html div element where the plot should appear
  • data is an array of JSON objects describing the various traces in the visualization
  • layout is a JSON object describing the layout properties of the visualization.

The graphdiv argument is handled automatically by one of the supported frontends, so users of this package will mostly be concerned about constructing the data and layout arguments.

For a complete list of traces and their attributes see the plotly.js chart attribute reference.

As of version 0.6.0 of this package you can also view a local version of this page that is a bit easier to navigate by calling the PlotlyJS.docs() function from the Julia prompt. This will open an electron window with a local webpage containing a version of that reference page.

Julia types

There are three core types for representing a visualization (not counting the two abstract types):

abstract AbstractTrace
abstract AbstractLayout

type GenericTrace{T<:Associative{Symbol,Any}} <: AbstractTrace
    kind::ASCIIString
    fields::T
end

type Layout{T<:Associative{Symbol,Any}} <: AbstractLayout
    fields::T
end

type Plot{TT<:AbstractTrace}
    data::Vector{TT}
    layout::AbstractLayout
    divid::Base.Random.UUID
end

The fields of the Plot type map 1-1 to the arguments to the Plotly.newplot function