gr fixes and tests; fillrange convertToAnyVector

This commit is contained in:
Thomas Breloff 2016-04-28 12:51:08 -04:00
parent ce58f25488
commit d67aec6fec
6 changed files with 34 additions and 13 deletions

View File

@ -41,9 +41,10 @@ script:
- julia -e 'Pkg.clone(pwd()); Pkg.build("Plots")'
# - julia -e 'Pkg.clone("https://github.com/tbreloff/Images.jl.git"); Pkg.checkout("Images","tom_imgcompare");'
# - julia -e 'Pkg.clone("Images"); Pkg.build("Images")'
# - julia -e 'Pkg.clone("ImageMagick"); Pkg.build("ImageMagick")'
- julia -e 'Pkg.clone("https://github.com/tbreloff/ImageMagick.jl.git"); Pkg.checkout("ImageMagick","tb_write"); Pkg.build("ImageMagick")'
- julia -e 'Pkg.clone("https://github.com/tbreloff/VisualRegressionTests.jl.git");'
- julia -e 'Pkg.clone("ImageMagick"); Pkg.build("ImageMagick")'
- julia -e 'Pkg.clone("GR"); Pkg.build("GR")'
# - julia -e 'Pkg.clone("https://github.com/tbreloff/ImageMagick.jl.git"); Pkg.checkout("ImageMagick","tb_write"); Pkg.build("ImageMagick")'
# - julia -e 'Pkg.clone("https://github.com/tbreloff/VisualRegressionTests.jl.git");'
- julia -e 'Pkg.clone("https://github.com/tbreloff/ExamplePlots.jl.git");'
- julia -e 'Pkg.clone("https://github.com/JunoLab/Blink.jl.git"); Pkg.build("Blink"); import Blink; Blink.AtomShell.install()'
- julia -e 'Pkg.clone("https://github.com/spencerlyon2/PlotlyJS.jl.git")'

View File

@ -200,10 +200,10 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
E = zeros(length(p[:x]),2)
E[:,1] = p[:x]
E[:,2] = p[:y]
if isa(p[:nbins], Tuple)
xbins, ybins = p[:nbins]
if isa(p[:bins], Tuple)
xbins, ybins = p[:bins]
else
xbins = ybins = p[:nbins]
xbins = ybins = p[:bins]
end
cmap = true
x, y, H = Base.hist2d(E, xbins, ybins)
@ -473,10 +473,10 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
E = zeros(length(p[:x]),2)
E[:,1] = p[:x]
E[:,2] = p[:y]
if isa(p[:nbins], Tuple)
xbins, ybins = p[:nbins]
if isa(p[:bins], Tuple)
xbins, ybins = p[:bins]
else
xbins = ybins = p[:nbins]
xbins = ybins = p[:bins]
end
x, y, H = Base.hist2d(E, xbins, ybins)
counts = round(Int32, 1000 + 255 * H / maximum(H))

View File

@ -130,11 +130,12 @@ supportedArgs(::GRBackend) = [
:group,
:label,
:linetype,
:seriescolor, :seriesalpha,
:linecolor, :linestyle, :linewidth, :linealpha,
:markershape, :markercolor, :markersize, :markeralpha,
:markerstrokewidth, :markerstrokecolor, :markerstrokealpha,
:fillrange, :fillcolor, :fillalpha,
:nbins,
:bins,
:n, :nc, :nr, :layout,
:smooth,
:title, :windowtitle, :show, :size,
@ -145,7 +146,7 @@ supportedArgs(::GRBackend) = [
:z,
:tickfont, :guidefont, :legendfont,
:grid, :legend, :colorbar,
:zcolor, :levels,
:marker_z, :levels,
:xerror, :yerror,
:ribbon, :quiver,
:orientation,

View File

@ -30,6 +30,14 @@ function convertToAnyVector{T<:Number}(v::AMat{T}, d::KW)
end, nothing
end
# other matrix... vector of columns
function convertToAnyVector(m::AMat, d::KW)
Any[begin
v = vec(m[:,i])
length(v) == 1 ? v[1] : v
end for i=1:size(m,2)], nothing
end
# function
convertToAnyVector(f::Function, d::KW) = Any[f], nothing
@ -101,6 +109,13 @@ function build_series_args(plt::AbstractPlot, kw::KW) #, idxfilter)
ys, ymeta = convertToAnyVector(y, kw)
zs, zmeta = convertToAnyVector(z, kw)
fr = pop!(kw, :fillrange, nothing)
fillranges, _ = if typeof(fr) <: Number
([fr],nothing)
else
convertToAnyVector(fr, kw)
end
mx = length(xs)
my = length(ys)
mz = length(zs)
@ -147,6 +162,9 @@ function build_series_args(plt::AbstractPlot, kw::KW) #, idxfilter)
if isa(d[:marker_z], Function)
d[:marker_z] = map(d[:marker_z], d[:x])
end
# @show fillranges
d[:fillrange] = fillranges[mod1(i,length(fillranges))]
if isa(d[:fillrange], Function)
d[:fillrange] = map(d[:fillrange], d[:x])
end

View File

@ -13,3 +13,4 @@ PyPlot
GR
DataFrames
RDatasets
VisualRegressionTests

View File

@ -23,14 +23,14 @@ facts("PyPlot") do
@fact pyplot() --> Plots.PyPlotBackend()
@fact backend() --> Plots.PyPlotBackend()
image_comparison_facts(:pyplot, skip=[19,23], eps=img_eps)
image_comparison_facts(:pyplot, skip=[19], eps=img_eps)
end
facts("GR") do
@fact gr() --> Plots.GRBackend()
@fact backend() --> Plots.GRBackend()
@linux_only image_comparison_facts(:gr, skip=[13,27], eps=img_eps)
@linux_only image_comparison_facts(:gr, skip=[24], eps=img_eps)
end
facts("Plotly") do