Merge pull request #1691 from daschw/performance

Performance improvements
This commit is contained in:
Daniel Schwabeneder 2018-08-26 22:52:50 +02:00 committed by GitHub
commit 3eabaf074a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 78 additions and 96 deletions

View File

@ -338,7 +338,11 @@ end
# draw the markers, one at a time # draw the markers, one at a time
function gr_draw_markers(series::Series, x, y, msize, mz) function gr_draw_markers(series::Series, x, y, clims, msize = series[:markersize])
isempty(x) && return
GR.setfillintstyle(GR.INTSTYLE_SOLID)
shapes = series[:markershape] shapes = series[:markershape]
if shapes != :none if shapes != :none
for i=1:length(x) for i=1:length(x)
@ -355,7 +359,7 @@ function gr_draw_markers(series::Series, x, y, msize, mz)
# draw the shape - don't draw filled area if marker shape is 1D # draw the shape - don't draw filled area if marker shape is 1D
if !(shape in (:hline, :vline, :+, :x)) if !(shape in (:hline, :vline, :+, :x))
cfunc(get_markercolor(series, i)) cfunc(get_markercolor(series, clims, i))
gr_set_transparency(get_markeralpha(series, i)) gr_set_transparency(get_markeralpha(series, i))
gr_draw_marker(x[i], y[i], msi, shape) gr_draw_marker(x[i], y[i], msi, shape)
end end
@ -363,13 +367,6 @@ function gr_draw_markers(series::Series, x, y, msize, mz)
end end
end end
function gr_draw_markers(series::Series, x, y, clims)
isempty(x) && return
mz = normalize_zvals(series[:marker_z], clims)
GR.setfillintstyle(GR.INTSTYLE_SOLID)
gr_draw_markers(series, x, y, series[:markersize], mz)
end
# --------------------------------------------------------- # ---------------------------------------------------------
function gr_set_line(lw, style, c) #, a) function gr_set_line(lw, style, c) #, a)
@ -1038,7 +1035,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
GR.setfillintstyle(GR.INTSTYLE_SOLID) GR.setfillintstyle(GR.INTSTYLE_SOLID)
fr_from, fr_to = (is_2tuple(frng) ? frng : (y, frng)) fr_from, fr_to = (is_2tuple(frng) ? frng : (y, frng))
for (i, rng) in enumerate(segments) for (i, rng) in enumerate(segments)
gr_set_fillcolor(get_fillcolor(series, i)) gr_set_fillcolor(get_fillcolor(series, clims, i))
fx = _cycle(x, vcat(rng, reverse(rng))) fx = _cycle(x, vcat(rng, reverse(rng)))
fy = vcat(_cycle(fr_from,rng), _cycle(fr_to,reverse(rng))) fy = vcat(_cycle(fr_from,rng), _cycle(fr_to,reverse(rng)))
gr_set_transparency(get_fillalpha(series, i)) gr_set_transparency(get_fillalpha(series, i))
@ -1049,7 +1046,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
# draw the line(s) # draw the line(s)
if st in (:path, :straightline) if st in (:path, :straightline)
for (i, rng) in enumerate(segments) for (i, rng) in enumerate(segments)
gr_set_line(get_linewidth(series, i), get_linestyle(series, i), get_linecolor(series, i)) #, series[:linealpha]) gr_set_line(get_linewidth(series, i), get_linestyle(series, i), get_linecolor(series, clims, i)) #, series[:linealpha])
gr_set_transparency(get_linealpha(series, i)) gr_set_transparency(get_linealpha(series, i))
arrowside = isa(series[:arrow], Arrow) ? series[:arrow].side : :none arrowside = isa(series[:arrow], Arrow) ? series[:arrow].side : :none
gr_polyline(x[rng], y[rng]; arrowside = arrowside) gr_polyline(x[rng], y[rng]; arrowside = arrowside)
@ -1129,7 +1126,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
lz = series[:line_z] lz = series[:line_z]
segments = iter_segments(series) segments = iter_segments(series)
for (i, rng) in enumerate(segments) for (i, rng) in enumerate(segments)
gr_set_line(get_linewidth(series, i), get_linestyle(series, i), get_linecolor(series, i)) #, series[:linealpha]) gr_set_line(get_linewidth(series, i), get_linestyle(series, i), get_linecolor(series, clims, i)) #, series[:linealpha])
gr_set_transparency(get_linealpha(series, i)) gr_set_transparency(get_linealpha(series, i))
GR.polyline3d(x[rng], y[rng], z[rng]) GR.polyline3d(x[rng], y[rng], z[rng])
end end
@ -1201,12 +1198,12 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
xseg, yseg = x[rng], y[rng] xseg, yseg = x[rng], y[rng]
# draw the interior # draw the interior
gr_set_fill(get_fillcolor(series, i)) gr_set_fill(get_fillcolor(series, clims, i))
gr_set_transparency(get_fillalpha(series, i)) gr_set_transparency(get_fillalpha(series, i))
GR.fillarea(xseg, yseg) GR.fillarea(xseg, yseg)
# draw the shapes # draw the shapes
gr_set_line(get_linewidth(series, i), get_linestyle(series, i), get_linecolor(series, i)) gr_set_line(get_linewidth(series, i), get_linestyle(series, i), get_linecolor(series, clims, i))
gr_set_transparency(get_linealpha(series, i)) gr_set_transparency(get_linealpha(series, i))
GR.polyline(xseg, yseg) GR.polyline(xseg, yseg)
end end
@ -1298,10 +1295,10 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
for series in series_list(sp) for series in series_list(sp)
should_add_to_legend(series) || continue should_add_to_legend(series) || continue
st = series[:seriestype] st = series[:seriestype]
gr_set_line(get_linewidth(series), get_linestyle(series), get_linecolor(series)) #, series[:linealpha]) gr_set_line(get_linewidth(series), get_linestyle(series), get_linecolor(series, clims)) #, series[:linealpha])
if (st == :shape || series[:fillrange] != nothing) && series[:ribbon] == nothing if (st == :shape || series[:fillrange] != nothing) && series[:ribbon] == nothing
gr_set_fill(get_fillcolor(series)) #, series[:fillalpha]) gr_set_fill(get_fillcolor(series, clims)) #, series[:fillalpha])
l, r = xpos-0.07, xpos-0.01 l, r = xpos-0.07, xpos-0.01
b, t = ypos-0.4dy, ypos+0.4dy b, t = ypos-0.4dy, ypos+0.4dy
x = [l, r, r, l, l] x = [l, r, r, l, l]
@ -1309,7 +1306,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
gr_set_transparency(get_fillalpha(series)) gr_set_transparency(get_fillalpha(series))
gr_polyline(x, y, GR.fillarea) gr_polyline(x, y, GR.fillarea)
gr_set_transparency(get_linealpha(series)) gr_set_transparency(get_linealpha(series))
gr_set_line(get_linewidth(series), get_linestyle(series), get_linecolor(series)) gr_set_line(get_linewidth(series), get_linestyle(series), get_linecolor(series, clims))
st == :shape && gr_polyline(x, y) st == :shape && gr_polyline(x, y)
end end
@ -1323,7 +1320,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
end end
if series[:markershape] != :none if series[:markershape] != :none
gr_draw_markers(series, xpos - .035, ypos, 6, nothing) gr_draw_markers(series, xpos - .035, ypos, clims, 6)
end end
if typeof(series[:label]) <: Array if typeof(series[:label]) <: Array

View File

@ -530,11 +530,14 @@ as_gradient(grad, α) = cgrad(alpha = α)
# get a dictionary representing the series params (d is the Plots-dict, d_out is the Plotly-dict) # get a dictionary representing the series params (d is the Plots-dict, d_out is the Plotly-dict)
function plotly_series(plt::Plot, series::Series) function plotly_series(plt::Plot, series::Series)
st = series[:seriestype] st = series[:seriestype]
if st == :shape
return plotly_series_shapes(plt, series)
end
sp = series[:subplot] sp = series[:subplot]
clims = get_clims(sp)
if st == :shape
return plotly_series_shapes(plt, series, clims)
end
d_out = KW() d_out = KW()
# these are the axes that the series should be mapped to # these are the axes that the series should be mapped to
@ -564,14 +567,13 @@ function plotly_series(plt::Plot, series::Series)
d_out[:colorbar] = KW(:title => sp[:colorbar_title]) d_out[:colorbar] = KW(:title => sp[:colorbar_title])
clims = sp[:clims]
if is_2tuple(clims) if is_2tuple(clims)
d_out[:zmin], d_out[:zmax] = clims d_out[:zmin], d_out[:zmax] = clims
end end
# set the "type" # set the "type"
if st in (:path, :scatter, :scattergl, :straightline, :path3d, :scatter3d) if st in (:path, :scatter, :scattergl, :straightline, :path3d, :scatter3d)
return plotly_series_segments(series, d_out, x, y, z) return plotly_series_segments(series, d_out, x, y, z, clims)
elseif st == :heatmap elseif st == :heatmap
x = heatmap_edges(x, sp[:xaxis][:scale]) x = heatmap_edges(x, sp[:xaxis][:scale])
@ -643,7 +645,7 @@ function plotly_series(plt::Plot, series::Series)
return [d_out] return [d_out]
end end
function plotly_series_shapes(plt::Plot, series::Series) function plotly_series_shapes(plt::Plot, series::Series, clims)
segments = iter_segments(series) segments = iter_segments(series)
d_outs = Vector{KW}(undef, length(segments)) d_outs = Vector{KW}(undef, length(segments))
@ -673,11 +675,11 @@ function plotly_series_shapes(plt::Plot, series::Series)
:x => vcat(x[rng], x[rng[1]]), :x => vcat(x[rng], x[rng[1]]),
:y => vcat(y[rng], y[rng[1]]), :y => vcat(y[rng], y[rng[1]]),
:fill => "tozeroy", :fill => "tozeroy",
:fillcolor => rgba_string(plot_color(get_fillcolor(series, i), get_fillalpha(series, i))), :fillcolor => rgba_string(plot_color(get_fillcolor(series, clims, i), get_fillalpha(series, i))),
)) ))
if series[:markerstrokewidth] > 0 if series[:markerstrokewidth] > 0
d_out[:line] = KW( d_out[:line] = KW(
:color => rgba_string(plot_color(get_linecolor(series, i), get_linealpha(series, i))), :color => rgba_string(plot_color(get_linecolor(series, clims, i), get_linealpha(series, i))),
:width => get_linewidth(series, i), :width => get_linewidth(series, i),
:dash => string(get_linestyle(series, i)), :dash => string(get_linestyle(series, i)),
) )
@ -697,7 +699,7 @@ function plotly_series_shapes(plt::Plot, series::Series)
d_outs d_outs
end end
function plotly_series_segments(series::Series, d_base::KW, x, y, z) function plotly_series_segments(series::Series, d_base::KW, x, y, z, clims)
st = series[:seriestype] st = series[:seriestype]
sp = series[:subplot] sp = series[:subplot]
isscatter = st in (:scatter, :scatter3d, :scattergl) isscatter = st in (:scatter, :scatter3d, :scattergl)
@ -726,10 +728,10 @@ function plotly_series_segments(series::Series, d_base::KW, x, y, z)
end end
if series[:fillrange] == true || series[:fillrange] == 0 || isa(series[:fillrange], Tuple) if series[:fillrange] == true || series[:fillrange] == 0 || isa(series[:fillrange], Tuple)
d_out[:fill] = "tozeroy" d_out[:fill] = "tozeroy"
d_out[:fillcolor] = rgba_string(plot_color(get_fillcolor(series, i), get_fillalpha(series, i))) d_out[:fillcolor] = rgba_string(plot_color(get_fillcolor(series, clims, i), get_fillalpha(series, i)))
elseif typeof(series[:fillrange]) <: Union{AbstractVector{<:Real}, Real} elseif typeof(series[:fillrange]) <: Union{AbstractVector{<:Real}, Real}
d_out[:fill] = "tonexty" d_out[:fill] = "tonexty"
d_out[:fillcolor] = rgba_string(plot_color(get_fillcolor(series, i), get_fillalpha(series, i))) d_out[:fillcolor] = rgba_string(plot_color(get_fillcolor(series, clims, i), get_fillalpha(series, i)))
elseif !(series[:fillrange] in (false, nothing)) elseif !(series[:fillrange] in (false, nothing))
@warn("fillrange ignored... plotly only supports filling to zero and to a vector of values. fillrange: $(series[:fillrange])") @warn("fillrange ignored... plotly only supports filling to zero and to a vector of values. fillrange: $(series[:fillrange])")
end end
@ -751,7 +753,7 @@ function plotly_series_segments(series::Series, d_base::KW, x, y, z)
:symbol => get(_plotly_markers, _cycle(series[:markershape], i), string(_cycle(series[:markershape], i))), :symbol => get(_plotly_markers, _cycle(series[:markershape], i), string(_cycle(series[:markershape], i))),
# :opacity => series[:markeralpha], # :opacity => series[:markeralpha],
:size => 2 * _cycle(series[:markersize], i), :size => 2 * _cycle(series[:markersize], i),
:color => rgba_string(plot_color(get_markercolor(series, i), get_markeralpha(series, i))), :color => rgba_string(plot_color(get_markercolor(series, clims, i), get_markeralpha(series, i))),
:line => KW( :line => KW(
:color => rgba_string(plot_color(get_markerstrokecolor(series, i), get_markerstrokealpha(series, i))), :color => rgba_string(plot_color(get_markerstrokecolor(series, i), get_markerstrokealpha(series, i))),
:width => _cycle(series[:markerstrokewidth], i), :width => _cycle(series[:markerstrokewidth], i),
@ -762,7 +764,7 @@ function plotly_series_segments(series::Series, d_base::KW, x, y, z)
# add "line" # add "line"
if hasline if hasline
d_out[:line] = KW( d_out[:line] = KW(
:color => rgba_string(plot_color(get_linecolor(series, i), get_linealpha(series, i))), :color => rgba_string(plot_color(get_linecolor(series, clims, i), get_linealpha(series, i))),
:width => get_linewidth(series, i), :width => get_linewidth(series, i),
:shape => if st == :steppre :shape => if st == :steppre
"vh" "vh"

View File

@ -436,12 +436,10 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
# handle zcolor and get c/cmap # handle zcolor and get c/cmap
needs_colorbar = hascolorbar(sp) needs_colorbar = hascolorbar(sp)
extrakw = if needs_colorbar || is_2tuple(sp[:clims]) vmin, vmax = clims = get_clims(sp)
vmin, vmax = get_clims(sp)
KW(:vmin => vmin, :vmax => vmax) # Dict to store extra kwargs
else extrakw = KW(:vmin => vmin, :vmax => vmax)
KW()
end
# holds references to any python object representing the matplotlib series # holds references to any python object representing the matplotlib series
handles = [] handles = []
@ -502,7 +500,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
handle = ax[:plot]((arg[rng] for arg in xyargs)...; handle = ax[:plot]((arg[rng] for arg in xyargs)...;
label = i == 1 ? series[:label] : "", label = i == 1 ? series[:label] : "",
zorder = series[:series_plotindex], zorder = series[:series_plotindex],
color = py_color(get_linecolor(series, i), get_linealpha(series, i)), color = py_color(get_linecolor(series, clims, i), get_linealpha(series, i)),
linewidth = py_thickness_scale(plt, get_linewidth(series, i)), linewidth = py_thickness_scale(plt, get_linewidth(series, i)),
linestyle = py_linestyle(st, get_linestyle(series, i)), linestyle = py_linestyle(st, get_linestyle(series, i)),
solid_capstyle = "round", solid_capstyle = "round",
@ -544,7 +542,8 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
:scatter3d, :steppre, :steppost, :scatter3d, :steppre, :steppost,
:bar) :bar)
markercolor = if any(typeof(series[arg]) <: AVec for arg in (:markercolor, :markeralpha)) || series[:marker_z] != nothing markercolor = if any(typeof(series[arg]) <: AVec for arg in (:markercolor, :markeralpha)) || series[:marker_z] != nothing
py_color(plot_color.(get_markercolor.(series, eachindex(x)), get_markeralpha.(series, eachindex(x)))) # py_color(plot_color.(get_markercolor.(series, clims, eachindex(x)), get_markeralpha.(series, eachindex(x))))
[py_color(plot_color(get_markercolor(series, clims, i), get_markeralpha(series, i))) for i in eachindex(x)]
else else
py_color(plot_color(series[:markercolor], series[:markeralpha])) py_color(plot_color(series[:markercolor], series[:markeralpha]))
end end
@ -692,11 +691,6 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
elseif typeof(z) <: AbstractVector elseif typeof(z) <: AbstractVector
# tri-surface plot (http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html#tri-surface-plots) # tri-surface plot (http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html#tri-surface-plots)
clims = sp[:clims]
if is_2tuple(clims)
isfinite(clims[1]) && (extrakw[:vmin] = clims[1])
isfinite(clims[2]) && (extrakw[:vmax] = clims[2])
end
handle = ax[:plot_trisurf](x, y, z; handle = ax[:plot_trisurf](x, y, z;
label = series[:label], label = series[:label],
zorder = series[:series_plotindex], zorder = series[:series_plotindex],
@ -767,8 +761,8 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
path; path;
label = series[:label], label = series[:label],
zorder = series[:series_plotindex], zorder = series[:series_plotindex],
edgecolor = py_color(get_linecolor(series, i), get_linealpha(series, i)), edgecolor = py_color(get_linecolor(series, clims, i), get_linealpha(series, i)),
facecolor = py_color(get_fillcolor(series, i), get_fillalpha(series, i)), facecolor = py_color(get_fillcolor(series, clims, i), get_fillalpha(series, i)),
linewidth = py_thickness_scale(plt, get_linewidth(series, i)), linewidth = py_thickness_scale(plt, get_linewidth(series, i)),
linestyle = py_linestyle(st, get_linestyle(series, i)), linestyle = py_linestyle(st, get_linestyle(series, i)),
fill = true fill = true
@ -817,7 +811,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
handle = ax[f](args..., trues(n), false, py_fillstepstyle(st); handle = ax[f](args..., trues(n), false, py_fillstepstyle(st);
zorder = series[:series_plotindex], zorder = series[:series_plotindex],
facecolor = py_color(get_fillcolor(series, i), get_fillalpha(series, i)), facecolor = py_color(get_fillcolor(series, clims, i), get_fillalpha(series, i)),
linewidths = 0 linewidths = 0
) )
push!(handles, handle) push!(handles, handle)
@ -1227,6 +1221,7 @@ const _pyplot_legend_pos = KW(
function py_add_legend(plt::Plot, sp::Subplot, ax) function py_add_legend(plt::Plot, sp::Subplot, ax)
leg = sp[:legend] leg = sp[:legend]
clims = get_clims(sp)
if leg != :none if leg != :none
# gotta do this to ensure both axes are included # gotta do this to ensure both axes are included
labels = [] labels = []
@ -1236,19 +1231,19 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
# add a line/marker and a label # add a line/marker and a label
push!(handles, if series[:seriestype] == :shape || series[:fillrange] != nothing push!(handles, if series[:seriestype] == :shape || series[:fillrange] != nothing
pypatches[:Patch]( pypatches[:Patch](
edgecolor = py_color(get_linecolor(series), get_linealpha(series)), edgecolor = py_color(get_linecolor(series, clims), get_linealpha(series)),
facecolor = py_color(get_fillcolor(series), get_fillalpha(series)), facecolor = py_color(get_fillcolor(series, clims), get_fillalpha(series)),
linewidth = py_thickness_scale(plt, clamp(get_linewidth(series), 0, 5)), linewidth = py_thickness_scale(plt, clamp(get_linewidth(series), 0, 5)),
linestyle = py_linestyle(series[:seriestype], get_linestyle(series)) linestyle = py_linestyle(series[:seriestype], get_linestyle(series))
) )
elseif series[:seriestype] in (:path, :straightline) elseif series[:seriestype] in (:path, :straightline)
PyPlot.plt[:Line2D]((0,1),(0,0), PyPlot.plt[:Line2D]((0,1),(0,0),
color = py_color(get_linecolor(series), get_linealpha(series)), color = py_color(get_linecolor(series, clims), get_linealpha(series)),
linewidth = py_thickness_scale(plt, clamp(get_linewidth(series), 0, 5)), linewidth = py_thickness_scale(plt, clamp(get_linewidth(series), 0, 5)),
linestyle = py_linestyle(:path, get_linestyle(series)), linestyle = py_linestyle(:path, get_linestyle(series)),
marker = py_marker(series[:markershape]), marker = py_marker(series[:markershape]),
markeredgecolor = py_color(get_markerstrokecolor(series), get_markerstrokealpha(series)), markeredgecolor = py_color(get_markerstrokecolor(series), get_markerstrokealpha(series)),
markerfacecolor = series[:marker_z] == nothing ? py_color(get_markercolor(series), get_markeralpha(series)) : py_color(series[:markercolor][0.5]) markerfacecolor = series[:marker_z] == nothing ? py_color(get_markercolor(series, clims), get_markeralpha(series)) : py_color(series[:markercolor][0.5])
) )
else else
series[:serieshandle][1] series[:serieshandle][1]

View File

@ -617,20 +617,40 @@ function hascolorbar(sp::Subplot)
hascbar hascbar
end end
function get_linecolor(series, i::Int = 1) for comp in (:line, :fill, :marker)
lc = series[:linecolor]
lz = series[:line_z] compcolor = string(comp, :color)
if lz == nothing get_compcolor = Symbol(:get_, compcolor)
isa(lc, ColorGradient) ? lc : plot_color(_cycle(lc, i)) comp_z = string(comp, :_z)
compalpha = string(comp, :alpha)
get_compalpha = Symbol(:get_, compalpha)
@eval begin
function $get_compcolor(series, cmin::Real, cmax::Real, i::Int = 1)
c = series[$Symbol($compcolor)]
z = series[$Symbol($comp_z)]
if z == nothing
isa(c, ColorGradient) ? c : plot_color(_cycle(c, i))
else else
cmin, cmax = get_clims(series[:subplot]) grad = isa(c, ColorGradient) ? c : cgrad()
grad = isa(lc, ColorGradient) ? lc : cgrad() grad[clamp((_cycle(z, i) - cmin) / (cmax - cmin), 0, 1)]
grad[clamp((_cycle(lz, i) - cmin) / (cmax - cmin), 0, 1)]
end end
end end
function get_linealpha(series, i::Int = 1) $get_compcolor(series, clims, i::Int = 1) = $get_compcolor(series, clims[1], clims[2], i)
_cycle(series[:linealpha], i)
function $get_compcolor(series, i::Int = 1)
if series[$Symbol($comp_z)] == nothing
$get_compcolor(series, 0, 1, i)
else
$get_compcolor(series, get_clims(series[:subplot]), i)
end
end
$get_compalpha(series, i::Int = 1) = _cycle(series[$Symbol($compalpha)], i)
end
end end
function get_linewidth(series, i::Int = 1) function get_linewidth(series, i::Int = 1)
@ -641,38 +661,6 @@ function get_linestyle(series, i::Int = 1)
_cycle(series[:linestyle], i) _cycle(series[:linestyle], i)
end end
function get_fillcolor(series, i::Int = 1)
fc = series[:fillcolor]
fz = series[:fill_z]
if fz == nothing
isa(fc, ColorGradient) ? fc : plot_color(_cycle(fc, i))
else
cmin, cmax = get_clims(series[:subplot])
grad = isa(fc, ColorGradient) ? fc : cgrad()
grad[clamp((_cycle(fz, i) - cmin) / (cmax - cmin), 0, 1)]
end
end
function get_fillalpha(series, i::Int = 1)
_cycle(series[:fillalpha], i)
end
function get_markercolor(series, i::Int = 1)
mc = series[:markercolor]
mz = series[:marker_z]
if mz == nothing
isa(mc, ColorGradient) ? mc : plot_color(_cycle(mc, i))
else
cmin, cmax = get_clims(series[:subplot])
grad = isa(mc, ColorGradient) ? mc : cgrad()
grad[clamp((_cycle(mz, i) - cmin) / (cmax - cmin), 0, 1)]
end
end
function get_markeralpha(series, i::Int = 1)
_cycle(series[:markeralpha], i)
end
function get_markerstrokecolor(series, i::Int = 1) function get_markerstrokecolor(series, i::Int = 1)
msc = series[:markerstrokecolor] msc = series[:markerstrokecolor]
isa(msc, ColorGradient) ? msc : _cycle(msc, i) isa(msc, ColorGradient) ? msc : _cycle(msc, i)