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 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") 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 diff --git a/src/recipes.jl b/src/recipes.jl index 972328ea..6ac0d11d 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -1024,10 +1024,6 @@ end @assert length(g.args) == 1 && typeof(g.args[1]) <: AbstractMatrix seriestype := :spy mat = g.args[1] - if length(unique(mat[mat .!= 0])) < 2 - legend --> nothing - seriescolor --> cgrad([invisible(), fg_color(plotattributes)]) - end n,m = size(mat) Plots.SliceIt, 1:m, 1:n, Surface(mat) end @@ -1035,21 +1031,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