From e0b7bdc1a57ca2d825275d9b4f56f0c077d4d98f Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Tue, 21 Aug 2018 17:21:06 +0200 Subject: [PATCH 1/8] Revert "Merge pull request #1155 from mkborregaard/newspy" This reverts commit b71cfce105b03014af9b6149453ad5b95952a831. --- src/recipes.jl | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/recipes.jl b/src/recipes.jl index be27cdd4..10e5d165 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -1035,21 +1035,23 @@ end @recipe function f(::Type{Val{:spy}}, x,y,z) yflip := true aspect_ratio := 1 - rs, cs, zs = findnz(z.surf) - newz = fill(NaN, size(z)...) - - for i in eachindex(zs) - newz[rs[i],cs[i]] = zs[i] + xlim := ignorenan_extrema(cs) + ylim := ignorenan_extrema(rs) + if plotattributes[:markershape] == :none + markershape := :circle end - - seriestype := :heatmap + if plotattributes[:markersize] == default(:markersize) + markersize := 1 + end + markerstrokewidth := 0 + marker_z := zs + label := "" + x := cs + y := rs + z := nothing + seriestype := :scatter grid --> false - framestyle --> :box - - x := x - y := y - z := Surface(newz) () end From c4233e28960f82b61d761eb2226147a3ba649e04 Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Tue, 21 Aug 2018 17:43:03 +0200 Subject: [PATCH 2/8] larger markers --- src/recipes.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/recipes.jl b/src/recipes.jl index 10e5d165..ffa30aac 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -1042,7 +1042,7 @@ end markershape := :circle end if plotattributes[:markersize] == default(:markersize) - markersize := 1 + markersize := 1.5 end markerstrokewidth := 0 marker_z := zs From 5c2bf5d76cff8f45a57bfa83bccfe38cb7095890 Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Fri, 24 Aug 2018 09:05:47 +0200 Subject: [PATCH 3/8] Don't color points --- src/recipes.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/recipes.jl b/src/recipes.jl index ffa30aac..3ad76b3d 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -1024,9 +1024,13 @@ end @assert length(g.args) == 1 && typeof(g.args[1]) <: AbstractMatrix seriestype := :spy mat = g.args[1] - if length(unique(mat[mat .!= 0])) < 2 + lunique = length(unique(mat[mat .!= 0])) + if lunique == 2 legend --> nothing seriescolor --> cgrad([invisible(), fg_color(plotattributes)]) + elseif lunique < 2 + legend --> nothing + seriescolor --> fg_color(plotattributes) end n,m = size(mat) Plots.SliceIt, 1:m, 1:n, Surface(mat) @@ -1045,7 +1049,7 @@ end markersize := 1.5 end markerstrokewidth := 0 - marker_z := zs + #marker_z := zs label := "" x := cs y := rs From 91f51778f1a43abcd39cda8a4463549d65dec256 Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Fri, 24 Aug 2018 10:06:03 +0200 Subject: [PATCH 4/8] Don't define invisible when two colors --- src/recipes.jl | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/recipes.jl b/src/recipes.jl index 3ad76b3d..ad03d6b8 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -1024,14 +1024,6 @@ end @assert length(g.args) == 1 && typeof(g.args[1]) <: AbstractMatrix seriestype := :spy mat = g.args[1] - lunique = length(unique(mat[mat .!= 0])) - if lunique == 2 - legend --> nothing - seriescolor --> cgrad([invisible(), fg_color(plotattributes)]) - elseif lunique < 2 - legend --> nothing - seriescolor --> fg_color(plotattributes) - end n,m = size(mat) Plots.SliceIt, 1:m, 1:n, Surface(mat) end @@ -1046,7 +1038,7 @@ end markershape := :circle end if plotattributes[:markersize] == default(:markersize) - markersize := 1.5 + markersize := 1 end markerstrokewidth := 0 #marker_z := zs From 9887892a923adc64a236ae1b3a9c015b456678e6 Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Tue, 28 Aug 2018 09:55:15 +0200 Subject: [PATCH 5/8] reinstate marker_z --- src/recipes.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/recipes.jl b/src/recipes.jl index ad03d6b8..7e6b5252 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -1041,7 +1041,7 @@ end markersize := 1 end markerstrokewidth := 0 - #marker_z := zs + marker_z := zs label := "" x := cs y := rs From 7ae4fae68c0e0a83410e00ba6d6c283e1cdb040a Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Wed, 29 Aug 2018 09:56:44 +0200 Subject: [PATCH 6/8] fix bug in aliases --- src/args.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/args.jl b/src/args.jl index dca2fd0f..8a3e92b1 100644 --- a/src/args.jl +++ b/src/args.jl @@ -466,7 +466,7 @@ autopick_ignore_none_auto(notarr, idx::Integer) = notarr function aliasesAndAutopick(plotattributes::KW, sym::Symbol, aliases::Dict{Symbol,Symbol}, options::AVec, plotIndex::Int) if plotattributes[sym] == :auto plotattributes[sym] = autopick_ignore_none_auto(options, plotIndex) - elseif haskey(aliases, [sym]) + elseif haskey(aliases, plotattributes[sym]) plotattributes[sym] = aliases[plotattributes[sym]] end end From c471d1e4c33d6da0b44b9bf4a5a208e00982aea9 Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Wed, 29 Aug 2018 09:56:59 +0200 Subject: [PATCH 7/8] finalize d -> plotattributes --- src/backends/glvisualize.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backends/glvisualize.jl b/src/backends/glvisualize.jl index 296b79e2..72288380 100644 --- a/src/backends/glvisualize.jl +++ b/src/backends/glvisualize.jl @@ -1144,11 +1144,11 @@ function _display(plt::Plot{GLVisualizeBackend}, visible = true) vis = gl_boxplot(plotattributes, kw_args) elseif st == :volume volume = plotattributes[:y] - _d = copy(plotattributes) - _d[:y] = 0:1 - _d[:x] = 0:1 + _plotattributes = copy(plotattributes) + _plotattributes[:y] = 0:1 + _plotattributes[:x] = 0:1 kw_args = KW() - extract_gradient(_d, kw_args, :fill) + extract_gradient(_plotattributes, kw_args, :fill) vis = visualize(volume.v, Style(:default), kw_args) else error("failed to display plot type $st") From cad0f15aed61a41d23c2296690fb475b5df5dfd6 Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Wed, 29 Aug 2018 18:38:53 +0200 Subject: [PATCH 8/8] fix plotly errors --- src/backends/plotly.jl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index 6036767a..3e525b5b 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -573,7 +573,7 @@ function plotly_series(plt::Plot, series::Series) # set the "type" if st in (:path, :scatter, :scattergl, :straightline, :path3d, :scatter3d) - return plotly_series_segments(series, plotattributes, x, y, z, clims) + return plotly_series_segments(series, plotattributes_out, x, y, z, clims) elseif st == :heatmap x = heatmap_edges(x, sp[:xaxis][:scale]) @@ -678,7 +678,7 @@ function plotly_series_shapes(plt::Plot, series::Series, clims) :fillcolor => rgba_string(plot_color(get_fillcolor(series, clims, i), get_fillalpha(series, i))), )) if series[:markerstrokewidth] > 0 - plotattributes[:line] = KW( + plotattributes_out[:line] = KW( :color => rgba_string(plot_color(get_linecolor(series, clims, i), get_linealpha(series, i))), :width => get_linewidth(series, i), :dash => string(get_linestyle(series, i)), @@ -699,7 +699,7 @@ function plotly_series_shapes(plt::Plot, series::Series, clims) plotattributes_outs end -function plotly_series_segments(series::Series, ploattributes_base::KW, x, y, z, clims) +function plotly_series_segments(series::Series, plotattributes_base::KW, x, y, z, clims) st = series[:seriestype] sp = series[:subplot] isscatter = st in (:scatter, :scatter3d, :scattergl) @@ -727,11 +727,11 @@ function plotly_series_segments(series::Series, ploattributes_base::KW, x, y, z, hasline ? "lines" : "none" end if series[:fillrange] == true || series[:fillrange] == 0 || isa(series[:fillrange], Tuple) - plotattributes[:fill] = "tozeroy" - plotattributes[:fillcolor] = rgba_string(plot_color(get_fillcolor(series, clims, i), get_fillalpha(series, i))) + plotattributes_out[:fill] = "tozeroy" + plotattributes_out[:fillcolor] = rgba_string(plot_color(get_fillcolor(series, clims, i), get_fillalpha(series, i))) elseif typeof(series[:fillrange]) <: Union{AbstractVector{<:Real}, Real} - plotattributes[:fill] = "tonexty" - plotattributes[:fillcolor] = rgba_string(plot_color(get_fillcolor(series, clims, i), get_fillalpha(series, i))) + plotattributes_out[:fill] = "tonexty" + plotattributes_out[:fillcolor] = rgba_string(plot_color(get_fillcolor(series, clims, i), get_fillalpha(series, i))) elseif !(series[:fillrange] in (false, nothing)) @warn("fillrange ignored... plotly only supports filling to zero and to a vector of values. fillrange: $(series[:fillrange])") end @@ -763,7 +763,7 @@ function plotly_series_segments(series::Series, ploattributes_base::KW, x, y, z, # add "line" if hasline - plotattributes[:line] = KW( + plotattributes_out[:line] = KW( :color => rgba_string(plot_color(get_linecolor(series, clims, i), get_linealpha(series, i))), :width => get_linewidth(series, i), :shape => if st == :steppre