plotly markercolors
This commit is contained in:
parent
517c2f456c
commit
ee18a9dd6c
@ -632,31 +632,17 @@ function plotly_series(plt::Plot, series::Series)
|
|||||||
|
|
||||||
# add "marker"
|
# add "marker"
|
||||||
if hasmarker
|
if hasmarker
|
||||||
|
inds = eachindex(x)
|
||||||
d_out[:marker] = KW(
|
d_out[:marker] = KW(
|
||||||
:symbol => get(_plotly_markers, series[:markershape], string(series[:markershape])),
|
:symbol => get(_plotly_markers, series[:markershape], string(series[:markershape])),
|
||||||
# :opacity => series[:markeralpha],
|
# :opacity => series[:markeralpha],
|
||||||
:size => 2 * series[:markersize],
|
:size => 2 * series[:markersize],
|
||||||
# :color => rgba_string(series[:markercolor]),
|
:color => rgba_string.(plot_color.(get_markercolor.(series, inds), get_markeralpha.(series, inds))),
|
||||||
:line => KW(
|
:line => KW(
|
||||||
:color => _cycle(rgba_string.(series[:markerstrokecolor]),eachindex(series[:x])),
|
:color => rgba_string.(plot_color.(get_markerstrokecolor.(series, inds), get_markerstrokealpha.(series, inds))),
|
||||||
:width => series[:markerstrokewidth],
|
:width => series[:markerstrokewidth],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
# gotta hack this (for now?) since plotly can't handle rgba values inside the gradient
|
|
||||||
if series[:marker_z] == nothing
|
|
||||||
d_out[:marker][:color] = _cycle(rgba_string.(series[:markercolor]),eachindex(series[:x]))
|
|
||||||
else
|
|
||||||
# grad = ColorGradient(series[:markercolor], alpha=series[:markeralpha])
|
|
||||||
# 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
|
end
|
||||||
|
|
||||||
plotly_polar!(d_out, series)
|
plotly_polar!(d_out, series)
|
||||||
@ -712,6 +698,8 @@ function plotly_series_shapes(plt::Plot, series::Series)
|
|||||||
push!(d_outs, plotly_colorbar_hack(series, base_d, :fill))
|
push!(d_outs, plotly_colorbar_hack(series, base_d, :fill))
|
||||||
elseif series[:line_z] != nothing
|
elseif series[:line_z] != nothing
|
||||||
push!(d_outs, plotly_colorbar_hack(series, base_d, :line))
|
push!(d_outs, plotly_colorbar_hack(series, base_d, :line))
|
||||||
|
elseif series[:marker_z] != nothing
|
||||||
|
push!(d_outs, plotly_colorbar_hack(series, base_d, :marker))
|
||||||
end
|
end
|
||||||
d_outs
|
d_outs
|
||||||
end
|
end
|
||||||
@ -765,31 +753,17 @@ function plotly_series_segments(series::Series, d_base::KW, x, y, z)
|
|||||||
|
|
||||||
# add "marker"
|
# add "marker"
|
||||||
if hasmarker
|
if hasmarker
|
||||||
|
inds = eachindex(x)
|
||||||
d_out[:marker] = KW(
|
d_out[:marker] = KW(
|
||||||
:symbol => get(_plotly_markers, series[:markershape], string(series[:markershape])),
|
:symbol => get(_plotly_markers, series[:markershape], string(series[:markershape])),
|
||||||
# :opacity => series[:markeralpha],
|
# :opacity => series[:markeralpha],
|
||||||
:size => 2 * series[:markersize],
|
:size => 2 * series[:markersize],
|
||||||
# :color => rgba_string(series[:markercolor]),
|
:color => rgba_string.(plot_color.(get_markercolor.(series, inds), get_markeralpha.(series, inds))),
|
||||||
:line => KW(
|
:line => KW(
|
||||||
:color => _cycle(rgba_string.(series[:markerstrokecolor]), eachindex(rng)),
|
:color => rgba_string.(plot_color.(get_markerstrokecolor.(series, inds), get_markerstrokealpha.(series, inds))),
|
||||||
:width => series[:markerstrokewidth],
|
:width => series[:markerstrokewidth],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
# gotta hack this (for now?) since plotly can't handle rgba values inside the gradient
|
|
||||||
if series[:marker_z] == nothing
|
|
||||||
d_out[:marker][:color] = _cycle(rgba_string.(series[:markercolor]), eachindex(rng))
|
|
||||||
else
|
|
||||||
# grad = ColorGradient(series[:markercolor], alpha=series[:markeralpha])
|
|
||||||
# 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 _cycle(series[:marker_z], rng)]
|
|
||||||
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
|
end
|
||||||
|
|
||||||
# add "line"
|
# add "line"
|
||||||
@ -848,6 +822,8 @@ function plotly_series_segments(series::Series, d_base::KW, x, y, z)
|
|||||||
push!(d_outs, plotly_colorbar_hack(series, d_base, :line))
|
push!(d_outs, plotly_colorbar_hack(series, d_base, :line))
|
||||||
elseif series[:fill_z] != nothing
|
elseif series[:fill_z] != nothing
|
||||||
push!(d_outs, plotly_colorbar_hack(series, d_base, :fill))
|
push!(d_outs, plotly_colorbar_hack(series, d_base, :fill))
|
||||||
|
elseif series[:marker_z] != nothing
|
||||||
|
push!(d_outs, plotly_colorbar_hack(series, d_base, :marker))
|
||||||
end
|
end
|
||||||
|
|
||||||
d_outs
|
d_outs
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user