diff --git a/deps/find_attr_groups.jl b/deps/find_attr_groups.jl index c9dead42..d5e6999e 100644 --- a/deps/find_attr_groups.jl +++ b/deps/find_attr_groups.jl @@ -35,11 +35,11 @@ function main() _SRC_ATTRS = collect(filter(x -> endswith(string(x), "src"), nms)) open(joinpath(@__DIR__, "src_attrs.csv"), "w") do f - writecsv(f, map(string, _SRC_ATTRS)) + writedlm(f, map(string, _SRC_ATTRS)) end open(joinpath(@__DIR__, "underscore_attrs.csv"), "w") do f - writecsv(f, map(string, _UNDERSCORE_ATTRS)) + writedlm(f, map(string, _UNDERSCORE_ATTRS)) end _UNDERSCORE_ATTRS, _SRC_ATTRS diff --git a/docs/basics.md b/docs/basics.md index 0e59fea4..a31291be 100644 --- a/docs/basics.md +++ b/docs/basics.md @@ -29,19 +29,22 @@ There are three core types for representing a visualization (not counting the two abstract types): ```julia -abstract AbstractTrace -abstract AbstractLayout +abstract type AbstractTrace +end +abstract type AbstractLayout + +end -type GenericTrace{T<:AbstractDict{Symbol,Any}} <: AbstractTrace +mutable struct GenericTrace{T<:AbstractDict{Symbol,Any}} <: AbstractTrace kind::ASCIIString fields::T end -type Layout{T<:AbstractDict{Symbol,Any}} <: AbstractLayout +mutable struct Layout{T<:AbstractDict{Symbol,Any}} <: AbstractLayout fields::T end -type Plot{TT<:AbstractTrace} +mutable struct Plot{TT<:AbstractTrace} data::Vector{TT} layout::AbstractLayout divid::Base.Random.UUID diff --git a/docs/building_traces_layouts.md b/docs/building_traces_layouts.md index d63f22a7..27a64421 100644 --- a/docs/building_traces_layouts.md +++ b/docs/building_traces_layouts.md @@ -9,7 +9,7 @@ A `Plot` instance will have a vector of `trace`s. These should each be a subtype PlotlyJS.jl defines one such subtype: ```julia -type GenericTrace{T<:AbstractDict{Symbol,Any}} <: AbstractTrace +mutable struct GenericTrace{T<:AbstractDict{Symbol,Any}} <: AbstractTrace kind::ASCIIString fields::T end @@ -239,7 +239,7 @@ julia> println(JSON.json(t1, 2)) The `Layout` type is defined as ```julia -type Layout{T<:AbstractDict{Symbol,Any}} <: AbstractLayout +mutable struct Layout{T<:AbstractDict{Symbol,Any}} <: AbstractLayout fields::T end ``` diff --git a/docs/contributing.md b/docs/contributing.md index 3307b296..7aa7f843 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -49,7 +49,7 @@ For example, if we wanted to add an example of a scatter plot of the sin functio ```julia function sin_scatter() - x = linspace(0, 2*pi, 50) + x = range(0, stop=2*pi, length=50) y = sin(x) plot(scatter(x=x, y=y, marker_symbol="line-nw", mode="markers+symbols")) end diff --git a/docs/examples/3d.md b/docs/examples/3d.md index d7eba3d0..75d24600 100644 --- a/docs/examples/3d.md +++ b/docs/examples/3d.md @@ -328,7 +328,7 @@ function meshcube() i=[7, 0, 0, 0, 4, 4, 6, 6, 4, 0, 3, 2], j=[3, 4, 1, 2, 5, 6, 5, 2, 0, 1, 6, 3], k=[0, 7, 2, 3, 6, 7, 1, 1, 5, 5, 7, 6], - intensity=linspace(0, 1, 8), + intensity=range(0, stop=1, length=8), colorscale=[ [0, "rgb(255, 0, 255)"], [0.5, "rgb(0, 255, 0)"], diff --git a/docs/examples/box_plots.md b/docs/examples/box_plots.md index bdedb936..603bf745 100644 --- a/docs/examples/box_plots.md +++ b/docs/examples/box_plots.md @@ -338,7 +338,7 @@ box9() ```julia function box10() n_box = 30 - colors = ["hsl($i, 50%, 50%)" for i in linspace(0, 360, n_box)] + colors = ["hsl($i, 50%, 50%)" for i in range(0, stop=360, length=n_box)] gen_y_data(i) = 3.5*sin(pi*i/n_box) + i/n_box + (1.5+0.5*cos(pi*i/n_box)).*rand(10) diff --git a/docs/syncplots.md b/docs/syncplots.md index 65ca2512..5fd2c028 100644 --- a/docs/syncplots.md +++ b/docs/syncplots.md @@ -7,7 +7,7 @@ We'll also discuss how to integrate with various frontends Recall that the definition of the `Plot` object is ```julia -type Plot{TT<:AbstractTrace} +mutable struct Plot{TT<:AbstractTrace} data::Vector{TT} layout::AbstractLayout divid::Base.Random.UUID @@ -124,7 +124,9 @@ To do this in a simple and reliable way we introduce the concept of a `SyncPlot`, which is defined as: ```julia -abstract AbstractPlotlyDisplay +abstract type AbstractPlotlyDisplay + +end struct SyncPlot{TD<:AbstractPlotlyDisplay} plot::Plot @@ -179,7 +181,7 @@ A convenient typealias has been defined for `SyncPlot`s with the `ElectronDisplay` frontend: ```julia -typealias ElectronPlot SyncPlot{ElectronDisplay} +const ElectronPlot = SyncPlot{ElectronDisplay} ``` Please note that the Electron frontend also allows PlotlyJS.jl figures to be @@ -201,7 +203,7 @@ for the plot as well as registering Julia functions as callbacks. A `SyncPlot` with a `JupyterDisplay` also has a typealias: ```julia -typealias JupyterPlot SyncPlot{JupyterDisplay} +const JupyterPlot = SyncPlot{JupyterDisplay} ``` Please note that the `JupyterPlot` frontend also allows PlotlyJS.jl figures to diff --git a/examples/3d.jl b/examples/3d.jl index 5b9c8a67..c6489291 100644 --- a/examples/3d.jl +++ b/examples/3d.jl @@ -234,7 +234,7 @@ function meshcube() i=[7, 0, 0, 0, 4, 4, 6, 6, 4, 0, 3, 2], j=[3, 4, 1, 2, 5, 6, 5, 2, 0, 1, 6, 3], k=[0, 7, 2, 3, 6, 7, 1, 1, 5, 5, 7, 6], - intensity=linspace(0, 1, 8), + intensity=range(0, stop=1, length=8), colorscale=[ [0, "rgb(255, 0, 255)"], [0.5, "rgb(0, 255, 0)"], diff --git a/examples/box_plots.jl b/examples/box_plots.jl index 2388673c..6ee60f37 100644 --- a/examples/box_plots.jl +++ b/examples/box_plots.jl @@ -201,7 +201,7 @@ end function box10() n_box = 30 - colors = ["hsl($i, 50%, 50%)" for i in linspace(0, 360, n_box)] + colors = ["hsl($i, 50%, 50%)" for i in range(0, stop=360, length=n_box)] gen_y_data(i) = 3.5*sin(pi*i/n_box) + i/n_box + (1.5+0.5*cos(pi*i/n_box)).*rand(10) diff --git a/examples/heatmaps.jl b/examples/heatmaps.jl index e07f5822..2fd110d8 100644 --- a/examples/heatmaps.jl +++ b/examples/heatmaps.jl @@ -1,5 +1,5 @@ using PlotlyJS -srand(42) +Random.seed!(42) function heatmap1() plot(heatmap(z=[1 20 30; 20 1 60; 30 60 1])) diff --git a/src/PlotlyJS.jl b/src/PlotlyJS.jl index 40b31fe6..af08ca01 100644 --- a/src/PlotlyJS.jl +++ b/src/PlotlyJS.jl @@ -1,5 +1,3 @@ -__precompile__() - module PlotlyJS using Reexport diff --git a/src/util.jl b/src/util.jl index 4135c48a..6f5a176a 100644 --- a/src/util.jl +++ b/src/util.jl @@ -4,10 +4,10 @@ JSON.lower(sp::SyncPlot) = JSON.lower(sp.plot) PlotlyBase._is3d(p::SyncPlot) = _is3d(p.plot) # subplot methods on syncplot -Base.hcat{TP<:SyncPlot}(sps::TP...) = TP(hcat([sp.plot for sp in sps]...)) -Base.vcat{TP<:SyncPlot}(sps::TP...) = TP(vcat([sp.plot for sp in sps]...)) -Base.vect{TP<:SyncPlot}(sps::TP...) = vcat(sps...) -Base.hvcat{TP<:SyncPlot}(rows::Tuple{Vararg{Int}}, sps::TP...) = +Base.hcat(sps::TP...) where {TP<:SyncPlot} = TP(hcat([sp.plot for sp in sps]...)) +Base.vcat(sps::TP...) where {TP<:SyncPlot} = TP(vcat([sp.plot for sp in sps]...)) +Base.vect(sps::TP...) where {TP<:SyncPlot} = vcat(sps...) +Base.hvcat(rows::Tuple{Vararg{Int}}, sps::TP...) where {TP<:SyncPlot} = TP(hvcat(rows, [sp.plot for sp in sps]...)) diff --git a/test/runtests.jl b/test/runtests.jl index 5dca1d94..318c5612 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,7 +1,7 @@ module PlotlyJSTest using TestSetExtensions -using Base.Test +using Test using PlotlyJS const M = PlotlyJS