-
-
Notifications
You must be signed in to change notification settings - Fork 290
/
scatterlines.jl
60 lines (54 loc) · 1.68 KB
/
scatterlines.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""
scatterlines(xs, ys, [zs]; kwargs...)
Plots `scatter` markers and `lines` between them.
## Attributes
$(ATTRIBUTES)
"""
@recipe(ScatterLines) do scene
s_theme = default_theme(scene, Scatter)
l_theme = default_theme(scene, Lines)
Attributes(
color = l_theme.color,
colormap = l_theme.colormap,
colorrange = get(l_theme.attributes, :colorrange, automatic),
linestyle = l_theme.linestyle,
linewidth = l_theme.linewidth,
markercolor = automatic,
markercolormap = s_theme.colormap,
markercolorrange = get(s_theme.attributes, :colorrange, automatic),
markersize = s_theme.markersize,
strokecolor = s_theme.strokecolor,
strokewidth = s_theme.strokewidth,
marker = s_theme.marker,
inspectable = theme(scene, :inspectable),
cycle = [:color],
)
end
function plot!(p::Combined{scatterlines, <:NTuple{N, Any}}) where N
# markercolor is the same as linecolor if left automatic
real_markercolor = lift(Any, p.color, p.markercolor) do col, mcol
if mcol === automatic
col
else
mcol
end
end
lines!(p, p[1:N]...;
color = p.color,
linestyle = p.linestyle,
linewidth = p.linewidth,
colormap = p.colormap,
colorrange = p.colorrange,
inspectable = p.inspectable
)
scatter!(p, p[1:N]...;
color = real_markercolor,
strokecolor = p.strokecolor,
strokewidth = p.strokewidth,
marker = p.marker,
markersize = p.markersize,
colormap = p.markercolormap,
colorrange = p.markercolorrange,
inspectable = p.inspectable
)
end