Merge pull request #1153 from daschw/gr-marker_z

Fix marker_z for 3D plots on GR (test example 24) (fix #1152)
This commit is contained in:
Daniel Schwabeneder 2017-10-10 21:06:01 +02:00 committed by GitHub
commit a4c59ce964

View File

@ -342,10 +342,6 @@ function gr_draw_markers(series::Series, x, y, clims)
mz = normalize_zvals(series[:marker_z], clims) mz = normalize_zvals(series[:marker_z], clims)
GR.setfillintstyle(GR.INTSTYLE_SOLID) GR.setfillintstyle(GR.INTSTYLE_SOLID)
gr_draw_markers(series, x, y, series[:markersize], mz) gr_draw_markers(series, x, y, series[:markersize], mz)
if hascolorbar(series[:subplot])
GR.setscale(0)
gr_colorbar(series[:subplot], clims)
end
end end
# --------------------------------------------------------- # ---------------------------------------------------------
@ -447,12 +443,6 @@ function gr_set_viewport_polar()
end end
# add the colorbar # add the colorbar
function gr_colorbar(sp::Subplot)
gr_set_viewport_cmap(sp)
GR.colorbar()
gr_set_viewport_plotarea()
end
function gr_colorbar(sp::Subplot, clims) function gr_colorbar(sp::Subplot, clims)
xmin, xmax = gr_xy_axislims(sp)[1:2] xmin, xmax = gr_xy_axislims(sp)[1:2]
gr_set_viewport_cmap(sp) gr_set_viewport_cmap(sp)
@ -961,9 +951,6 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
series[:fillalpha] != nothing && GR.settransparency(series[:fillalpha]) series[:fillalpha] != nothing && GR.settransparency(series[:fillalpha])
GR.fillarea(fx, fy) GR.fillarea(fx, fy)
end end
gr_set_line(1, :solid, yaxis[:foreground_color_axis])
GR.settransparency(1)
cmap && gr_colorbar(sp, clims)
end end
# draw the line(s) # draw the line(s)
@ -973,8 +960,6 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
arrowside = isa(series[:arrow], Arrow) ? series[:arrow].side : :none arrowside = isa(series[:arrow], Arrow) ? series[:arrow].side : :none
gr_polyline(x[rng], y[rng]; arrowside = arrowside) gr_polyline(x[rng], y[rng]; arrowside = arrowside)
end end
gr_set_line(1, :solid, yaxis[:foreground_color_axis])
cmap && gr_colorbar(sp, clims)
end end
end end
@ -1022,7 +1007,6 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
GR.setfillcolorind(0) GR.setfillcolorind(0)
GR.surface(x, y, z, GR.OPTION_FILLED_MESH) GR.surface(x, y, z, GR.OPTION_FILLED_MESH)
end end
cmap && gr_colorbar(sp)
elseif st == :heatmap elseif st == :heatmap
xmin, xmax, ymin, ymax = xy_lims xmin, xmax, ymin, ymax = xy_lims
@ -1036,7 +1020,6 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
round(Int, red(c) * 255) ), colors) round(Int, red(c) * 255) ), colors)
w, h = length(x), length(y) w, h = length(x), length(y)
GR.drawimage(xmin, xmax, ymax, ymin, w, h, rgba) GR.drawimage(xmin, xmax, ymax, ymin, w, h, rgba)
cmap && gr_colorbar(sp, clims)
elseif st in (:path3d, :scatter3d) elseif st in (:path3d, :scatter3d)
# draw path # draw path
@ -1052,8 +1035,6 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
gr_set_line(series[:linewidth], series[:linestyle], get_linecolor(sp, series, i)) #, series[:linealpha]) gr_set_line(series[:linewidth], series[:linestyle], get_linecolor(sp, series, i)) #, series[:linealpha])
GR.polyline3d(x[rng], y[rng], z[rng]) GR.polyline3d(x[rng], y[rng], z[rng])
end end
gr_set_line(1, :solid, yaxis[:foreground_color_axis])
cmap && gr_colorbar(sp, clims)
end end
end end
@ -1129,8 +1110,6 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
GR.polyline(xseg, yseg) GR.polyline(xseg, yseg)
end end
end end
gr_set_line(1, :solid, yaxis[:foreground_color_axis])
cmap && gr_colorbar(sp, clims)
elseif st == :image elseif st == :image
@ -1148,6 +1127,13 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
GR.drawimage(xmin, xmax, ymax, ymin, w, h, rgba) GR.drawimage(xmin, xmax, ymax, ymin, w, h, rgba)
end 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.settransparency(1)
gr_colorbar(sp, clims)
end
# this is all we need to add the series_annotations text # this is all we need to add the series_annotations text
anns = series[:series_annotations] anns = series[:series_annotations]
for (xi,yi,str,fnt) in EachAnn(anns, x, y) for (xi,yi,str,fnt) in EachAnn(anns, x, y)