gr: use correct colorbar scaling

This commit is contained in:
Josef Heinen 2017-05-08 14:36:25 -07:00
parent 598211c349
commit 5e6a9da3ed

View File

@ -813,12 +813,12 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
isfinite(clims[1]) && (zmin = clims[1]) isfinite(clims[1]) && (zmin = clims[1])
isfinite(clims[2]) && (zmax = clims[2]) isfinite(clims[2]) && (zmax = clims[2])
end end
GR.setspace(zmin, zmax, 0, 90)
if typeof(series[:levels]) <: Array if typeof(series[:levels]) <: Array
h = series[:levels] h = series[:levels]
else else
h = linspace(zmin, zmax, series[:levels]) h = linspace(zmin, zmax, series[:levels])
end end
GR.setspace(zmin, zmax, 0, 90)
if series[:fillrange] != nothing if series[:fillrange] != nothing
GR.surface(x, y, z, GR.OPTION_CELL_ARRAY) GR.surface(x, y, z, GR.OPTION_CELL_ARRAY)
else else
@ -856,6 +856,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
isfinite(clims[1]) && (zmin = clims[1]) isfinite(clims[1]) && (zmin = clims[1])
isfinite(clims[2]) && (zmax = clims[2]) isfinite(clims[2]) && (zmax = clims[2])
end end
GR.setspace(zmin, zmax, 0, 90)
grad = isa(series[:fillcolor], ColorGradient) ? series[:fillcolor] : cgrad() grad = isa(series[:fillcolor], ColorGradient) ? series[:fillcolor] : cgrad()
colors = [grad[clamp((zi-zmin) / (zmax-zmin), 0, 1)] for zi=z] colors = [grad[clamp((zi-zmin) / (zmax-zmin), 0, 1)] for zi=z]
rgba = map(c -> UInt32( round(Int, alpha(c) * 255) << 24 + rgba = map(c -> UInt32( round(Int, alpha(c) * 255) << 24 +