From 23ec52c6b4071e5c290cbe2a6d6ff4adfe66ad22 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Mon, 13 Aug 2018 00:04:22 -0700 Subject: [PATCH] Make sure only one colorbar is drawn with GR closes #1642 --- src/backends/gr.jl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 0c2253fe..9e7fbc7a 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -1227,16 +1227,18 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) gr_text(GR.wctondc(xi, yi)..., str) end - # draw the colorbar - if cmap && st != :contour # special colorbar with steps is drawn for contours - gr_set_line(1, :solid, yaxis[:foreground_color_axis]) - gr_set_transparency(1) - gr_colorbar(sp, clims) - end - GR.restorestate() end + # draw the colorbar + GR.savestate() + # special colorbar with steps is drawn for contours + if cmap && any(series[:seriestype] != :contour for series in series_list(sp)) + gr_set_line(1, :solid, yaxis[:foreground_color_axis]) + gr_set_transparency(1) + gr_colorbar(sp, clims) + end + GR.restorestate() # add the legend if sp[:legend] != :none