plotlyjs travis; plotly/plotlyjs polar
This commit is contained in:
parent
18fc50fcbf
commit
4bf8e342dc
23
.travis.yml
23
.travis.yml
@ -1,11 +1,22 @@
|
|||||||
# Documentation: http://docs.travis-ci.com/user/languages/julia/
|
# Documentation: http://docs.travis-ci.com/user/languages/julia/
|
||||||
language: julia
|
language: julia
|
||||||
os:
|
# os:
|
||||||
- linux
|
# - linux
|
||||||
- osx
|
# - osx
|
||||||
julia:
|
# julia:
|
||||||
- 0.4
|
# - 0.4
|
||||||
#- nightly
|
# #- nightly
|
||||||
|
|
||||||
|
# borrowed from Blink.jl's travis file
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: linux
|
||||||
|
julia: 0.4
|
||||||
|
env: TESTCMD="xvfb-run julia"
|
||||||
|
- os: osx
|
||||||
|
julia: 0.4
|
||||||
|
env: TESTCMD="julia"
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email: true
|
email: true
|
||||||
# uncomment the following lines to override the default test script
|
# uncomment the following lines to override the default test script
|
||||||
|
|||||||
@ -245,6 +245,10 @@ function plotly_layout(d::KW)
|
|||||||
d_out[:annotations] = [get_annotation_dict(ann...) for ann in anns]
|
d_out[:annotations] = [get_annotation_dict(ann...) for ann in anns]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if get(d, :polar, false)
|
||||||
|
d_out[:direction] = "counterclockwise"
|
||||||
|
end
|
||||||
|
|
||||||
d_out
|
d_out
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -269,7 +273,7 @@ const _plotly_markers = KW(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# get a dictionary representing the series params (d is the Plots-dict, d_out is the Plotly-dict)
|
# get a dictionary representing the series params (d is the Plots-dict, d_out is the Plotly-dict)
|
||||||
function plotly_series(d::KW; plot_index = nothing)
|
function plotly_series(d::KW, plotargs::KW; plot_index = nothing)
|
||||||
# dumpdict(d,"series",true)
|
# dumpdict(d,"series",true)
|
||||||
d_out = KW()
|
d_out = KW()
|
||||||
|
|
||||||
@ -406,8 +410,8 @@ function plotly_series(d::KW; plot_index = nothing)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# convert polar plots x/y to theta/radius
|
# convert polar plots x/y to theta/radius
|
||||||
if get(d, :polar, false)
|
if get(plotargs, :polar, false)
|
||||||
d_out[:t] = pop!(d_out, :x)
|
d_out[:t] = rad2deg(pop!(d_out, :x))
|
||||||
d_out[:r] = pop!(d_out, :y)
|
d_out[:r] = pop!(d_out, :y)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -422,14 +426,14 @@ end
|
|||||||
|
|
||||||
# get a list of dictionaries, each representing the series params
|
# get a list of dictionaries, each representing the series params
|
||||||
function get_series_json(plt::Plot{PlotlyBackend})
|
function get_series_json(plt::Plot{PlotlyBackend})
|
||||||
JSON.json(map(plotly_series, plt.seriesargs))
|
JSON.json(map(d -> plotly_series(d, plt.plotargs), plt.seriesargs))
|
||||||
end
|
end
|
||||||
|
|
||||||
function get_series_json(subplt::Subplot{PlotlyBackend})
|
function get_series_json(subplt::Subplot{PlotlyBackend})
|
||||||
ds = KW[]
|
ds = KW[]
|
||||||
for (i,plt) in enumerate(subplt.plts)
|
for (i,plt) in enumerate(subplt.plts)
|
||||||
for d in plt.seriesargs
|
for d in plt.seriesargs
|
||||||
push!(ds, plotly_series(d, plot_index = i))
|
push!(ds, plotly_series(d, plt.plotargs, plot_index = i))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
JSON.json(ds)
|
JSON.json(ds)
|
||||||
@ -454,7 +458,7 @@ function html_body(plt::Plot{PlotlyBackend}, style = nothing)
|
|||||||
Plotly.plot(PLOT, $(get_series_json(plt)), $(get_plot_json(plt)));
|
Plotly.plot(PLOT, $(get_series_json(plt)), $(get_plot_json(plt)));
|
||||||
</script>
|
</script>
|
||||||
"""
|
"""
|
||||||
# @show html
|
@show html
|
||||||
html
|
html
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -37,14 +37,11 @@ function _add_series(::PlotlyJSBackend, plt::Plot; kw...)
|
|||||||
d = KW(kw)
|
d = KW(kw)
|
||||||
syncplot = plt.o
|
syncplot = plt.o
|
||||||
|
|
||||||
# dumpdict(d, "addseries", true)
|
|
||||||
|
|
||||||
# add to the data array
|
# add to the data array
|
||||||
pdict = plotly_series(d)
|
pdict = plotly_series(d, plt.plotargs)
|
||||||
typ = pop!(pdict, :type)
|
typ = pop!(pdict, :type)
|
||||||
gt = PlotlyJS.GenericTrace(typ; pdict...)
|
gt = PlotlyJS.GenericTrace(typ; pdict...)
|
||||||
PlotlyJS.addtraces!(syncplot, gt)
|
PlotlyJS.addtraces!(syncplot, gt)
|
||||||
# PlotlyJS.addtraces!(syncplot.plot, gt)
|
|
||||||
|
|
||||||
push!(plt.seriesargs, d)
|
push!(plt.seriesargs, d)
|
||||||
plt
|
plt
|
||||||
@ -70,11 +67,9 @@ end
|
|||||||
# TODO: override this to update plot items (title, xlabel, etc) after creation
|
# TODO: override this to update plot items (title, xlabel, etc) after creation
|
||||||
function _update_plot(plt::Plot{PlotlyJSBackend}, d::KW)
|
function _update_plot(plt::Plot{PlotlyJSBackend}, d::KW)
|
||||||
pdict = plotly_layout(d)
|
pdict = plotly_layout(d)
|
||||||
# dumpdict(pdict, "pdict updateplot", true)
|
|
||||||
syncplot = plt.o
|
syncplot = plt.o
|
||||||
w,h = d[:size]
|
w,h = d[:size]
|
||||||
PlotlyJS.relayout!(syncplot, pdict, width = w, height = h)
|
PlotlyJS.relayout!(syncplot, pdict, width = w, height = h)
|
||||||
# PlotlyJS.relayout!(syncplot.plot, pdict, width = w, height = h)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -92,10 +87,12 @@ end
|
|||||||
|
|
||||||
function setxy!{X,Y}(plt::Plot{PlotlyJSBackend}, xy::Tuple{X,Y}, i::Integer)
|
function setxy!{X,Y}(plt::Plot{PlotlyJSBackend}, xy::Tuple{X,Y}, i::Integer)
|
||||||
d = plt.seriesargs[i]
|
d = plt.seriesargs[i]
|
||||||
d[:x], d[:y] = xy
|
ispolar = get(plt.plotargs, :polar, false)
|
||||||
|
xsym = ispolar ? :t : :x
|
||||||
|
ysym = ispolar ? :r : :y
|
||||||
|
d[xsym], d[ysym] = xy
|
||||||
# TODO: this is likely ineffecient... we should make a call that ONLY changes the plot data
|
# TODO: this is likely ineffecient... we should make a call that ONLY changes the plot data
|
||||||
# PlotlyJS.restyle!(plt.o, i, plotly_series(d))
|
PlotlyJS.restyle!(plt.o, i, KW(xsym=>(d[xsym],), ysym=>(d[ysym],)))
|
||||||
PlotlyJS.restyle!(plt.o, i, KW(:x=>(d[:x],), :y=>(d[:y],)))
|
|
||||||
plt
|
plt
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -508,6 +508,7 @@ supportedArgs(::PlotlyBackend) = [
|
|||||||
:ribbon,
|
:ribbon,
|
||||||
:quiver,
|
:quiver,
|
||||||
:orientation,
|
:orientation,
|
||||||
|
:polar,
|
||||||
]
|
]
|
||||||
supportedAxes(::PlotlyBackend) = [:auto, :left]
|
supportedAxes(::PlotlyBackend) = [:auto, :left]
|
||||||
supportedTypes(::PlotlyBackend) = [:none, :line, :path, :scatter, :steppre, :steppost,
|
supportedTypes(::PlotlyBackend) = [:none, :line, :path, :scatter, :steppre, :steppost,
|
||||||
@ -583,6 +584,7 @@ supportedArgs(::PlotlyJSBackend) = [
|
|||||||
:ribbon,
|
:ribbon,
|
||||||
:quiver,
|
:quiver,
|
||||||
:orientation,
|
:orientation,
|
||||||
|
:polar,
|
||||||
]
|
]
|
||||||
supportedAxes(::PlotlyJSBackend) = [:auto, :left]
|
supportedAxes(::PlotlyJSBackend) = [:auto, :left]
|
||||||
supportedTypes(::PlotlyJSBackend) = [:none, :line, :path, :scatter, :steppre, :steppost,
|
supportedTypes(::PlotlyJSBackend) = [:none, :line, :path, :scatter, :steppre, :steppost,
|
||||||
|
|||||||
@ -16,14 +16,14 @@ facts("Gadfly") do
|
|||||||
@fact plot(sort(rand(10)), rand(Int, 10, 3)) --> not(nothing)
|
@fact plot(sort(rand(10)), rand(Int, 10, 3)) --> not(nothing)
|
||||||
@fact plot!(rand(10,3), rand(10,3)) --> not(nothing)
|
@fact plot!(rand(10,3), rand(10,3)) --> not(nothing)
|
||||||
|
|
||||||
image_comparison_facts(:gadfly, skip=[4,6,19,23,24], eps=img_eps)
|
image_comparison_facts(:gadfly, skip=[4,6,19,23,24,27], eps=img_eps)
|
||||||
end
|
end
|
||||||
|
|
||||||
facts("PyPlot") do
|
facts("PyPlot") do
|
||||||
@fact pyplot() --> Plots.PyPlotBackend()
|
@fact pyplot() --> Plots.PyPlotBackend()
|
||||||
@fact backend() --> Plots.PyPlotBackend()
|
@fact backend() --> Plots.PyPlotBackend()
|
||||||
|
|
||||||
image_comparison_facts(:pyplot, skip=[4,10,13,19,21,23], eps=img_eps)
|
image_comparison_facts(:pyplot, skip=[4,10,13,19,21,23,27], eps=img_eps)
|
||||||
end
|
end
|
||||||
|
|
||||||
facts("GR") do
|
facts("GR") do
|
||||||
@ -37,7 +37,7 @@ facts("PlotlyJS") do
|
|||||||
@fact plotlyjs() --> Plots.PlotlyJSBackend()
|
@fact plotlyjs() --> Plots.PlotlyJSBackend()
|
||||||
@fact backend() --> Plots.PlotlyJSBackend()
|
@fact backend() --> Plots.PlotlyJSBackend()
|
||||||
|
|
||||||
image_comparison_facts(:plotlyjs, only=[1,2,3,4,7,8,9,10,11,12,14,15,20,22,23,24], eps=img_eps)
|
image_comparison_facts(:plotlyjs, only=[1,2,3,4,7,8,9,10,11,12,14,15,20,22,23,24,27], eps=img_eps)
|
||||||
end
|
end
|
||||||
|
|
||||||
FactCheck.exitstatus()
|
FactCheck.exitstatus()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user