Change clims behaviour (gr heatmap)
This commit is contained in:
parent
d1d4b4fe33
commit
5ed50c8365
@ -2091,15 +2091,15 @@ function gr_draw_heatmap(series, x, y, z, clims)
|
||||
# pdf output, and also supports alpha values.
|
||||
# Note that drawimage draws uniformly spaced data correctly
|
||||
# even on log scales, where it is visually non-uniform.
|
||||
colors = if series[:subplot][:colorbar_scale] == :identity
|
||||
colors = plot_color.(get(fillgrad, z, clims), series[:fillalpha])
|
||||
colors, _z = if series[:subplot][:colorbar_scale] == :identity
|
||||
plot_color.(get(fillgrad, z, clims), series[:fillalpha]), z
|
||||
elseif series[:subplot][:colorbar_scale] == :log10
|
||||
z_log = log10.(z)
|
||||
z_log = replace(x -> isinf(x) ? NaN : x, log10.(z))
|
||||
z_normalized = get_z_normalized.(z_log, log10.(clims)...)
|
||||
colors = plot_color.(map(z -> get(fillgrad, z), z_normalized), series[:fillalpha])
|
||||
plot_color.(map(z -> get(fillgrad, z), z_normalized), series[:fillalpha]), z_log
|
||||
end
|
||||
for i in eachindex(colors)
|
||||
if z[i] < (clims[1])
|
||||
if isnan(_z[i])
|
||||
colors[i] = set_RGBA_alpha(0, colors[i])
|
||||
end
|
||||
end
|
||||
@ -2109,21 +2109,17 @@ function gr_draw_heatmap(series, x, y, z, clims)
|
||||
if something(series[:fillalpha], 1) < 1
|
||||
@warn "GR: transparency not supported in non-uniform heatmaps. Alpha values ignored."
|
||||
end
|
||||
z_normalized = if series[:subplot][:colorbar_scale] == :identity
|
||||
get_z_normalized.(z, clims...)
|
||||
z_normalized, _z = if series[:subplot][:colorbar_scale] == :identity
|
||||
get_z_normalized.(z, clims...), z
|
||||
elseif series[:subplot][:colorbar_scale] == :log10
|
||||
z_log = log10.(z)
|
||||
z_log = map(z -> isinf(z) ? Inf : z, z_log)
|
||||
z_min = minimum(z_log)
|
||||
z_log = map(z -> isinf(z) ? z_min : z, z_log)
|
||||
get_z_normalized.(z_log, minimum(z_log), maximum(z_log))
|
||||
z_log = replace(x -> isinf(x) ? NaN : x, log10.(z))
|
||||
get_z_normalized.(z_log, log10.(clims)...), z_log
|
||||
end
|
||||
rgba = Int32[round(Int32, 1000 + _i * 255) for _i in z_normalized]
|
||||
background_color_ind = gr_getcolorind(plot_color(series[:subplot][:background_color_inside]))
|
||||
for i in eachindex(rgba)
|
||||
if z[i] < (clims[1])
|
||||
rgba[i] = 0 # White, not transparent
|
||||
elseif z[i] > (clims[end])
|
||||
rgba[i] = 1255
|
||||
if isnan(_z[i])
|
||||
rgba[i] = background_color_ind
|
||||
end
|
||||
end
|
||||
if !ispolar(series)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user