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

Push version #29

Merged
merged 6 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
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
14 changes: 6 additions & 8 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
name = "SankeyPlots"
uuid = "8fd88ec8-d95c-41fc-b299-05f2225f2cc5"
authors = ["Daniel Schwabeneder <[email protected]> and Davide Fioriti <[email protected]>"]
version = "0.2.2"
version = "0.3.0"

[deps]
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
LayeredLayouts = "f4a74d36-062a-4d48-97cd-1356bad1de4e"
MetaGraphs = "626554b9-1ddb-594c-aa3c-2596fe9399a5"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[compat]
Graphs = "1.5"
LayeredLayouts = "0.2.4"
MetaGraphs = "0.7"
Plots = "1"
RecipesBase = "1"
julia = "1.5"
Graphs = "1.10"
LayeredLayouts = "0.2.10"
MetaGraphs = "0.8"
Plots = "1.35"
julia = "1"

[extras]
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ pkg> add SankeyPlots

## Usage

The following examples describes how to create a Sankey diagram with the default settings.
The Sankey diagram is described by passing to the `sankey` function the source nodes `src`, destination nodes `dst`, and the weights `weights` of the edges. The nodes are indexed by integers starting from 1, and the size of the blocks and flows are proportional to the weights.

```julia
using SankeyPlots

Expand Down
10 changes: 6 additions & 4 deletions src/SankeyPlots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module SankeyPlots

using LayeredLayouts
using Plots
using RecipesBase
using Graphs, MetaGraphs
using SparseArrays

Expand Down Expand Up @@ -37,8 +36,8 @@ In addition to [Plots.jl attributes](http://docs.juliaplots.org/latest/attribute
label_position=:inside,
label_size=8,
compact=false,
force_layer::Vector{Pair{Int,Int}}=Vector{Pair{Int,Int}}(),
force_order::Vector{Pair{Int,Int}}=Vector{Pair{Int,Int}}(),
force_layer=Vector{Pair{Int,Int}}(),
force_order=Vector{Pair{Int,Int}}(),
)
g = sankey_graph(s.args...)
names = sankey_names(g, node_labels)
Expand Down Expand Up @@ -197,7 +196,10 @@ In addition to [Plots.jl attributes](http://docs.juliaplots.org/latest/attribute

primary := false
framestyle --> :none
legend --> label_position === :legend ? :outertopright : false
legend --> label_position === :legend ? true : false
if label_position === :legend
legend_position --> :outertopright
end
()
end

Expand Down
Binary file modified test/refs/edge_color_#789.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/refs/edge_color_dst.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/refs/edge_color_manual.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/refs/edge_color_src.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/refs/force_layer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/refs/force_order.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/refs/label_position_bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/refs/label_position_left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/refs/label_position_legend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/refs/label_position_node.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/refs/label_position_right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/refs/label_position_top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/refs/readme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/refs/readme_kwargs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ energy_colors = palette(:seaborn_colorblind)[[9, 10, 3, 5, 2, 8, 1, 4]]
@testset "force_order" begin
@test_reference "refs/force_order.png" sankey(
src, dst, weights;
force_order=[1=>5] # node 1 shall come before node 5
force_order=[1=>2, 1=>5, 6=>3, 3=>4] # node 1 shall come before node 5
)
end
end
Loading