diff --git a/appveyor.yml b/appveyor.yml index 623ce5c..925b3cc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,4 +31,4 @@ build_script: Pkg.clone(pwd(), \"Vega\"); Pkg.build(\"Vega\")" test_script: - - C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.add(\"PyCall\");Pkg.add(\"RDatasets\");Pkg.test(\"Vega\")" + - C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.add(\"RDatasets\");Pkg.test(\"Vega\")" diff --git a/src/intermediates/modifiers.jl b/src/intermediates/modifiers.jl index ff19905..eac456f 100644 --- a/src/intermediates/modifiers.jl +++ b/src/intermediates/modifiers.jl @@ -55,7 +55,7 @@ function legend!(v::VegaVisualization; title::AbstractString="Group", show::Bool end #Use ColorBrewer.jl scales -function colorscheme!(v::VegaVisualization; palette::Union{Tuple{AbstractString,Any}, AbstractString, Array} = "ordinal10") +function colorscheme!(v::VegaVisualization; palette::Union{Tuple{AbstractString,Any}, AbstractString, Array} = "ordinal10", reversePalette::Bool = false) #See if group or color key exists i = findfirst([z.name == "group" for z in v.scales]) @@ -66,11 +66,11 @@ function colorscheme!(v::VegaVisualization; palette::Union{Tuple{AbstractString, #colorscheme, single color or array of arbitrary string colors if isa(palette, Tuple) - s.range = colorpalettes[palette[1]]["$(palette[2])"] + reversePalette == true? s.range = reverse(colorpalettes[palette[1]]["$(palette[2])"]) : s.range = colorpalettes[palette[1]]["$(palette[2])"] elseif isa(palette, AbstractString) s.range = [palette] elseif isa(palette, Array) - s.range = palette + reversePalette == true? s.range = reverse([palette]) : s.range = [palette] end return v diff --git a/test/runtests.jl b/test/runtests.jl index edd5001..ece3c79 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -547,7 +547,7 @@ ylim!(a, _type = "pow") @test typeof(a) == VegaVisualization #51 lineplot with sqrt yaxis -println("Test 50") +println("Test 51") x = [1:100; 1:100] y = [collect(1:100) + randn(100); 3.0 + 1.5 * collect(1:100) + randn(100)] group = [[1 for i in 1:100]; [2 for i in 1:100]] @@ -555,3 +555,13 @@ group = [[1 for i in 1:100]; [2 for i in 1:100]] a = lineplot(x = x, y = y, group = group) ylim!(a, _type = "sqrt") @test typeof(a) == VegaVisualization + +#52 reverse keyword for colorscheme! +println("Test 52") +x = [1:100; 1:100] +y = [collect(1:100) + randn(100); 3.0 + 1.5 * collect(1:100) + randn(100)] +group = [[1 for i in 1:100]; [2 for i in 1:100]] + +a = lineplot(x = x, y = y, group = group) +colorscheme!(a, palette = ("wesanderson", "BottleRocket1"), reversePalette = true) +@test typeof(a) == VegaVisualization