gr: added support for polar heatmaps
This commit is contained in:
parent
bbf8b50ad6
commit
71cbaa843c
@ -1318,21 +1318,29 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
dmin, dmax = GR.gr3.volume(y.v, 0)
|
dmin, dmax = GR.gr3.volume(y.v, 0)
|
||||||
|
|
||||||
elseif st == :heatmap
|
elseif st == :heatmap
|
||||||
xmin, xmax, ymin, ymax = xy_lims
|
|
||||||
zmin, zmax = clims
|
zmin, zmax = clims
|
||||||
m, n = length(x), length(y)
|
if !ispolar(sp)
|
||||||
xinds = sort(1:m, rev = xaxis[:flip])
|
xmin, xmax, ymin, ymax = xy_lims
|
||||||
yinds = sort(1:n, rev = yaxis[:flip])
|
m, n = length(x), length(y)
|
||||||
z = reshape(reshape(z, m, n)[xinds, yinds], m*n)
|
xinds = sort(1:m, rev = xaxis[:flip])
|
||||||
GR.setspace(zmin, zmax, 0, 90)
|
yinds = sort(1:n, rev = yaxis[:flip])
|
||||||
grad = isa(series[:fillcolor], ColorGradient) ? series[:fillcolor] : cgrad()
|
z = reshape(reshape(z, m, n)[xinds, yinds], m*n)
|
||||||
colors = [plot_color(grad[clamp((zi-zmin) / (zmax-zmin), 0, 1)], series[:fillalpha]) for zi=z]
|
GR.setspace(zmin, zmax, 0, 90)
|
||||||
rgba = map(c -> UInt32( round(UInt, alpha(c) * 255) << 24 +
|
grad = isa(series[:fillcolor], ColorGradient) ? series[:fillcolor] : cgrad()
|
||||||
round(UInt, blue(c) * 255) << 16 +
|
colors = [plot_color(grad[clamp((zi-zmin) / (zmax-zmin), 0, 1)], series[:fillalpha]) for zi=z]
|
||||||
round(UInt, green(c) * 255) << 8 +
|
rgba = map(c -> UInt32( round(UInt, alpha(c) * 255) << 24 +
|
||||||
round(UInt, red(c) * 255) ), colors)
|
round(UInt, blue(c) * 255) << 16 +
|
||||||
w, h = length(x), length(y)
|
round(UInt, green(c) * 255) << 8 +
|
||||||
GR.drawimage(xmin, xmax, ymax, ymin, w, h, rgba)
|
round(UInt, red(c) * 255) ), colors)
|
||||||
|
w, h = length(x), length(y)
|
||||||
|
GR.drawimage(xmin, xmax, ymax, ymin, w, h, rgba)
|
||||||
|
else
|
||||||
|
h, w = length(x), length(y)
|
||||||
|
z = reshape(z, h, w)
|
||||||
|
colors = Int32[round(Int32, 1000 + _i * 255) for _i in z']
|
||||||
|
GR.setwindow(-1, 1, -1, 1)
|
||||||
|
GR.polarcellarray(0, 0, 0, 360, 0, 1, w, h, colors)
|
||||||
|
end
|
||||||
|
|
||||||
elseif st in (:path3d, :scatter3d)
|
elseif st in (:path3d, :scatter3d)
|
||||||
# draw path
|
# draw path
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user