Merge pull request #3097 from daschw/gr-clims

ensure non-identical clims for gr
This commit is contained in:
Daniel Schwabeneder 2020-10-24 21:13:25 +02:00 committed by GitHub
commit 8ce603d3eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 4 deletions

View File

@ -889,6 +889,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 = one(hi)
elseif lo < 0
hi = zero(hi)
else
lo = zero(lo)
end
end
return lo, hi
end
function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
_update_min_padding!(sp)
@ -926,7 +940,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)
@ -975,7 +989,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)
@ -1535,7 +1549,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)

View File

@ -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