Skip to content

Commit

Permalink
Merge pull request #12 from davide-f/transparent-marker
Browse files Browse the repository at this point in the history
Transparent node markers
  • Loading branch information
davide-f authored Feb 7, 2022
2 parents efd7b86 + bee37fb commit deff880
Showing 1 changed file with 11 additions and 11 deletions.
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

0 comments on commit deff880

Please sign in to comment.