From d3343c43a19168b9b600d5b99ac51e645a604c6f Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Fri, 23 Oct 2020 22:12:10 +0200 Subject: [PATCH 1/3] ensure non-identical clims for gr --- src/backends/gr.jl | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 9cf15144..3677c4bb 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -856,6 +856,20 @@ function get_z_normalized(z, clims...) return remap(clamp(z, clims...), clims...) end +function gr_clims(args...) + lo, hi = get_clims(args...) + if lo == hi + if lo == 0 + hi = 1.0 + elseif lo < 0 + hi = 0.0 + else + lo = 0.0 + end + end + return lo, hi +end + function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) _update_min_padding!(sp) @@ -893,7 +907,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) end # draw the colorbar - hascolorbar(sp) && gr_draw_colorbar(cbar, sp, get_clims(sp), viewport_plotarea) + hascolorbar(sp) && gr_draw_colorbar(cbar, sp, gr_clims(sp), viewport_plotarea) # add the legend gr_add_legend(sp, leg, viewport_plotarea) @@ -942,7 +956,7 @@ function gr_add_legend(sp, leg, viewport_plotarea) gr_set_font(legendfont(sp), sp) end for series in series_list(sp) - clims = get_clims(sp, series) + clims = gr_clims(sp, series) should_add_to_legend(series) || continue st = series[:seriestype] lc = get_linecolor(series, clims) @@ -1502,7 +1516,7 @@ function gr_add_series(sp, series) x, y = convert_to_polar(x, y, (rmin, rmax)) end - clims = get_clims(sp, series) + clims = gr_clims(sp, series) # add custom frame shapes to markershape? series_annotations_shapes!(series) From 00351ebcf193b7fea36645726e5ddac5bf483678 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Fri, 23 Oct 2020 22:16:19 +0200 Subject: [PATCH 2/3] hopefully more type-stable in general --- src/backends/gr.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 3677c4bb..8112166e 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -860,11 +860,11 @@ function gr_clims(args...) lo, hi = get_clims(args...) if lo == hi if lo == 0 - hi = 1.0 + hi = one(hi) elseif lo < 0 - hi = 0.0 + hi = zero(hi) else - lo = 0.0 + lo = zero(lo) end end return lo, hi From 54fdd4e177869f91308d66fcfaec8745eb14f32c Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Sat, 24 Oct 2020 00:02:47 +0200 Subject: [PATCH 3/3] update spy recipe --- src/recipes.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/recipes.jl b/src/recipes.jl index 8ff2fa64..e805fa49 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -1483,7 +1483,11 @@ end markersize := 1 end markerstrokewidth := 0 - marker_z := zs + if length(unique(zs)) == 1 + seriescolor --> :black + else + marker_z := zs + end label := "" x := cs y := rs