Skip to content

Commit 92c6d10

Browse files
Merge pull request #146 from JackDevine/fix_fill_color
Use a list of vectors rather than a NaN sepearted list to denote shapes
2 parents 42ba340 + 930316d commit 92c6d10

File tree

5 files changed

+32
-18
lines changed

5 files changed

+32
-18
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
version:
25-
- '1.0'
2625
- '1'
2726
os:
2827
- ubuntu-latest

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ NaNMath = "0.3.3"
2525
NetworkLayout = "0.2, 0.3"
2626
PlotUtils = "0.6.2, 1"
2727
RecipesBase = "0.7, 0.8, 1"
28-
julia = "^1"
28+
julia = "^1.6"
2929

3030
[extras]
3131
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"

assets/arc_chord_diagrams.png

6.11 KB
Loading

assets/random_labelled_graph.png

2.69 KB
Loading

src/graphs.jl

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ more details.
342342
remove_aliases!(arg, plotattributes, graph_aliases)
343343
end
344344
# The above process will remove all marker properties from the plotattributes
345-
# dictionary. To enusre consistency between markers and nodes, we replace all marker
345+
# dictionary. To ensure consistency between markers and nodes, we replace all marker
346346
# properties with the corresponding node property.
347347
marker_node_collection = zip([:markershape,:markersize,:markercolor,
348348
:marker_z,:markerstrokealpha,:markeralpha,
@@ -352,9 +352,23 @@ more details.
352352
nodealpha,nodestrokewidth,nodestrokealpha,
353353
nodestrokecolor,nodestrokestyle])
354354
for (markerproperty, nodeproperty) in marker_node_collection
355+
# Make sure that the node properties are row vectors.
356+
nodeproperty isa Array && (nodeproperty = permutedims(vec(nodeproperty)))
355357
plotattributes[markerproperty] = nodeproperty
356358
end
357359

360+
# Make sure that the node properties are row vectors.
361+
nodeshape isa Array && (nodeshape = permutedims(vec(nodeshape)))
362+
nodesize isa Array && (nodesize = permutedims(vec(nodesize)))
363+
nodecolor isa Array && (nodecolor = permutedims(vec(nodecolor)))
364+
node_z isa Array && (node_z = permutedims(vec(node_z)))
365+
nodestrokealpha isa Array && (nodestrokealpha = permutedims(vec(nodestrokealpha)))
366+
nodealpha isa Array && (nodealpha = permutedims(vec(nodealpha)))
367+
nodestrokewidth isa Array && (nodestrokewidth = permutedims(vec(nodestrokewidth)))
368+
nodestrokealpha isa Array && (nodestrokealpha = permutedims(vec(nodestrokealpha)))
369+
nodestrokecolor isa Array && (nodestrokecolor = permutedims(vec(nodestrokecolor)))
370+
nodestrokestyle isa Array && (nodestrokestyle = permutedims(vec(nodestrokestyle)))
371+
358372
# If we pass a value of plotattributes[:markershape] that the backend does not
359373
# recognize, then the backend will throw an error. The error is thrown despite the
360374
# fact that we override the default behavior. Custom nodehapes are incompatible
@@ -427,7 +441,7 @@ more details.
427441
xl, yl = arcdiagram_limits(x, source, destiny)
428442
xlims --> xl
429443
ylims --> yl
430-
ratio --> :equal
444+
aspect_ratio --> :equal
431445
elseif all(axis_buffer .< 0) # equal axes
432446
ahw = 1.2 * 0.5 * maximum(v -> maximum(v)-minimum(v), xyz)
433447
xcenter = mean(extrema(x))
@@ -774,6 +788,9 @@ more details.
774788
round(Int, length(edges_list[1])/nsegments)),
775789
reshape(edges_list[2], nsegments,
776790
round(Int, length(edges_list[2])/nsegments)))
791+
edges_list = ([edges_list[1][:, j] for j in 1:size(edges_list[1], 2)],
792+
[edges_list[2][:, j] for j in 1:size(edges_list[2], 2)]
793+
)
777794
else
778795
edges_list = (reshape(edges_list[1], 3,
779796
round(Int, length(edges_list[1])/3)),
@@ -858,7 +875,7 @@ more details.
858875
seriestype := :scatter
859876
markersize := 0
860877
markeralpha := 0
861-
ratio --> :equal
878+
aspect_ratio --> :equal
862879
if length(names) == length(x)
863880
annotations := [(x[i], y[i], names[i]) for i in 1:length(x)]
864881
end
@@ -879,12 +896,12 @@ more details.
879896
end
880897
else
881898
if _3d
882-
# seriestype := :scatter3d
883-
# linewidth := 0
884-
# linealpha := 0
885-
# markercolor := nodecolor
886-
# series_annotations --> map(string,names)
887-
# markersize --> (10 .+ (100 .* node_weights) ./ sum(node_weights))
899+
seriestype := :scatter3d
900+
linewidth := 0
901+
linealpha := 0
902+
markercolor := nodecolor
903+
series_annotations --> map(string,names)
904+
markersize --> (10 .+ (100 .* node_weights) ./ sum(node_weights))
888905
else
889906
@series begin
890907
seriestype := :shape
@@ -902,14 +919,12 @@ more details.
902919
linestyle := nodestrokestyle
903920
line_z := nodestroke_z
904921

905-
nodeperimeters = (T[], T[])
922+
nodeperimeters = (Any[], Any[])
906923
for (i, vec_xy) in enumerate(node_vec_vec_xy)
907-
append!(nodeperimeters[1], [xy[1] for xy in vec_xy])
908-
push!(nodeperimeters[1], NaN)
909-
910-
append!(nodeperimeters[2], [xy[2] for xy in vec_xy])
911-
push!(nodeperimeters[2], NaN)
924+
push!(nodeperimeters[1], [xy[1] for xy in vec_xy])
925+
push!(nodeperimeters[2], [xy[2] for xy in vec_xy])
912926
end
927+
913928
nodeperimeters
914929

915930
# if _3d
@@ -926,7 +941,7 @@ more details.
926941
colorbar_entry --> false
927942
markersize --> 0
928943
markeralpha --> 0
929-
!isnothing(edgelabel) && (annotation --> edge_label_array)
944+
!isnothing(edgelabel) && (annotations --> edge_label_array)
930945
else
931946
seriestype := :scatter
932947

0 commit comments

Comments
 (0)