From 7ba128db712e195434cf4caf55add84eb6461215 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Sun, 17 Sep 2017 19:14:44 +0200 Subject: [PATCH] fix marker_z for plotly --- src/backends/plotly.jl | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index 8da2be0f..6753787e 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -575,14 +575,18 @@ function plotly_series(plt::Plot, series::Series) ) # gotta hack this (for now?) since plotly can't handle rgba values inside the gradient - d_out[:marker][:color] = if series[:marker_z] == nothing - rgba_string(series[:markercolor]) + if series[:marker_z] == nothing + d_out[:marker][:color] = rgba_string(series[:markercolor]) else # grad = ColorGradient(series[:markercolor], alpha=series[:markeralpha]) - grad = as_gradient(series[:markercolor], series[:markeralpha]) - zmin, zmax = ignorenan_extrema(series[:marker_z]) - zrange = zmax == zmin ? 1 : zmax - zmin # if all marker_z values are the same, plot all markers same color (avoids division by zero in next line) - [rgba_string(grad[(zi - zmin) / zrange]) for zi in series[:marker_z]] + # grad = as_gradient(series[:markercolor], series[:markeralpha]) + cmin, cmax = get_clims(sp) + # zrange = zmax == zmin ? 1 : zmax - zmin # if all marker_z values are the same, plot all markers same color (avoids division by zero in next line) + d_out[:marker][:color] = [clamp(zi, cmin, cmax) for zi in series[:marker_z]] + d_out[:marker][:cmin] = cmin + d_out[:marker][:cmax] = cmax + d_out[:marker][:colorscale] = plotly_colorscale(series[:markercolor], series[:markeralpha]) + d_out[:marker][:showscale] = hascolorbar(sp) end end