Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transparent node markers #12

Merged
merged 4 commits into from
Feb 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/SankeyPlots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ In addition to [Plots.jl attributes](http://docs.juliaplots.org/latest/attribute
if node_colors === nothing
node_colors = palette(get(plotattributes, :color_palette, :default))
end

x, y, mask = sankey_layout!(g)
perm = sortperm(y, rev=true)

vw = vertex_weight.(Ref(g), vertices(g))
m = maximum(vw)

if compact == true
y = make_compact(x, y, vw / m)
end

src_offsets = get_src_offsets(g, perm) ./ m
dst_offsets = get_dst_offsets(g, perm) ./ m

Expand All @@ -63,10 +63,10 @@ In addition to [Plots.jl attributes](http://docs.juliaplots.org/latest/attribute
ylabs = Float64[]
lab_orientations = Symbol[]
end

for (i, v) in enumerate(vertices(g))
h = vw[i] / (2m)

if !(mask[i])
@series begin
seriestype := :shape
Expand Down Expand Up @@ -104,7 +104,7 @@ In addition to [Plots.jl attributes](http://docs.juliaplots.org/latest/attribute
y_coords = remap(1 ./ (1 .+ exp.(6 .* (1 .- 2 .* x_coords))), y_src, y_dst)
append!(sankey_y, y_coords)
sankey_x = range(x[i]+0.1, x[k]-0.1, step=0.01)

@series begin
seriestype := :path
primary := false
Expand Down Expand Up @@ -166,18 +166,18 @@ In addition to [Plots.jl attributes](http://docs.juliaplots.org/latest/attribute
@series begin
primary := :false
seriestype := :scatter
markersize := 0
markeralpha := 0
series_annotations := text.(names, lab_orientations, label_size)
xlabs, ylabs
end

# extend axes for labels
if label_position in (:left, :right)
x_extra = label_position === :left ? minimum(xlabs) - 0.4 : maximum(xlabs) + 0.5
@series begin
primary := false
seriestype := :scatter
markersize := 0
markeralpha := 0
[x_extra], [ylabs[1]]
end
end
Expand Down Expand Up @@ -325,7 +325,7 @@ function make_compact(x, y, w)
for (i, inds) in enumerate(uinds)
y[inds] .+= (maxh - heights[i]) / 2
end
return y
return y
end

end