update iter_segments for scatters
This commit is contained in:
parent
22f69a99e2
commit
34d9d042aa
@ -175,9 +175,6 @@ function pgf_marker(d, i = 1)
|
|||||||
shape = _cycle(d[:markershape], i)
|
shape = _cycle(d[:markershape], i)
|
||||||
cstr, a = pgf_color(plot_color(get_markercolor(d, i), get_markeralpha(d, i)))
|
cstr, a = pgf_color(plot_color(get_markercolor(d, i), get_markeralpha(d, i)))
|
||||||
cstr_stroke, a_stroke = pgf_color(plot_color(get_markerstrokecolor(d, i), get_markerstrokealpha(d, i)))
|
cstr_stroke, a_stroke = pgf_color(plot_color(get_markerstrokecolor(d, i), get_markerstrokealpha(d, i)))
|
||||||
if d[:markerstrokealpha] != nothing
|
|
||||||
a_stroke = _cycle(d[:markerstrokealpha], i)
|
|
||||||
end
|
|
||||||
"""
|
"""
|
||||||
mark = $(get(_pgfplots_markers, shape, "*")),
|
mark = $(get(_pgfplots_markers, shape, "*")),
|
||||||
mark size = $(0.5 * _cycle(d[:markersize], i)),
|
mark size = $(0.5 * _cycle(d[:markersize], i)),
|
||||||
@ -219,10 +216,6 @@ function pgf_series(sp::Subplot, series::Series)
|
|||||||
straightline_data(series)
|
straightline_data(series)
|
||||||
elseif st == :shape
|
elseif st == :shape
|
||||||
shape_data(series)
|
shape_data(series)
|
||||||
elseif d[:marker_z] != nothing
|
|
||||||
# If a marker_z is used pass it as third coordinate to a 2D plot.
|
|
||||||
# See "Scatter Plots" in PGFPlots documentation
|
|
||||||
d[:x], d[:y], d[:marker_z]
|
|
||||||
elseif ispolar(sp)
|
elseif ispolar(sp)
|
||||||
theta, r = filter_radial_data(d[:x], d[:y], axis_limits(sp[:yaxis]))
|
theta, r = filter_radial_data(d[:x], d[:y], axis_limits(sp[:yaxis]))
|
||||||
rad2deg.(theta), r
|
rad2deg.(theta), r
|
||||||
|
|||||||
@ -580,19 +580,9 @@ function plotly_series(plt::Plot, series::Series)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# set the "type"
|
# set the "type"
|
||||||
if st in (:path, :straightline, :path3d)
|
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)
|
||||||
|
|
||||||
elseif st in (:scatter, :scattergl)
|
|
||||||
d_out[:type] = string(st)
|
|
||||||
d_out[:mode] = hasline ? "lines+markers" : "markers"
|
|
||||||
d_out[:x], d_out[:y] = x, y
|
|
||||||
|
|
||||||
elseif st == :scatter3d
|
|
||||||
d_out[:mode] = string(st)
|
|
||||||
d_out[:mode] = hasline ? "lines+markers" : "markers"
|
|
||||||
d_out[:x], d_out[:y], d_out[:z] = x, y, z
|
|
||||||
|
|
||||||
elseif st == :heatmap
|
elseif st == :heatmap
|
||||||
d_out[:type] = "heatmap"
|
d_out[:type] = "heatmap"
|
||||||
d_out[:x], d_out[:y], d_out[:z] = x, y, z
|
d_out[:x], d_out[:y], d_out[:z] = x, y, z
|
||||||
@ -658,17 +648,7 @@ function plotly_series(plt::Plot, series::Series)
|
|||||||
plotly_polar!(d_out, series)
|
plotly_polar!(d_out, series)
|
||||||
plotly_hover!(d_out, series[:hover])
|
plotly_hover!(d_out, series[:hover])
|
||||||
|
|
||||||
d_outs = [d_out]
|
return [d_out]
|
||||||
if series[:marker_z] != nothing
|
|
||||||
d_base = KW(
|
|
||||||
:xaxis => "x$(x_idx)",
|
|
||||||
:yaxis => "y$(y_idx)",
|
|
||||||
:name => series[:label],
|
|
||||||
)
|
|
||||||
push!(d_outs, plotly_colorbar_hack(series, d_base, :marker))
|
|
||||||
end
|
|
||||||
|
|
||||||
return d_outs
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function plotly_series_shapes(plt::Plot, series::Series)
|
function plotly_series_shapes(plt::Plot, series::Series)
|
||||||
@ -738,7 +718,7 @@ function plotly_series_segments(series::Series, d_base::KW, x, y, z)
|
|||||||
d_outs = Vector{KW}((hasfillrange ? 2 : 1 ) * length(segments))
|
d_outs = Vector{KW}((hasfillrange ? 2 : 1 ) * length(segments))
|
||||||
|
|
||||||
for (i,rng) in enumerate(segments)
|
for (i,rng) in enumerate(segments)
|
||||||
length(rng) < 2 && continue
|
!isscatter && length(rng) < 2 && continue
|
||||||
|
|
||||||
d_out = deepcopy(d_base)
|
d_out = deepcopy(d_base)
|
||||||
d_out[:showlegend] = i==1 ? should_add_to_legend(series) : false
|
d_out[:showlegend] = i==1 ? should_add_to_legend(series) : false
|
||||||
@ -778,9 +758,9 @@ 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, 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),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -195,7 +195,11 @@ end
|
|||||||
function iter_segments(series::Series)
|
function iter_segments(series::Series)
|
||||||
x, y, z = series[:x], series[:y], series[:z]
|
x, y, z = series[:x], series[:y], series[:z]
|
||||||
if has_attribute_segments(series)
|
if has_attribute_segments(series)
|
||||||
return [i:(i + 1) for i in 1:(length(y) - 1)]
|
if series[:seriestype] in (:scatter, :scatter3d)
|
||||||
|
return [[i] for i in 1:length(y)]
|
||||||
|
else
|
||||||
|
return [i:(i + 1) for i in 1:(length(y) - 1)]
|
||||||
|
end
|
||||||
else
|
else
|
||||||
segs = UnitRange{Int64}[]
|
segs = UnitRange{Int64}[]
|
||||||
args = is3d(series) ? (x, y, z) : (x, y)
|
args = is3d(series) ? (x, y, z) : (x, y)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user