Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure non-identical clims for gr #3097

Merged
merged 3 commits into from
Oct 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/backends/gr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 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)

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion src/recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down