NetworkLayout.jl icon indicating copy to clipboard operation
NetworkLayout.jl copied to clipboard

add option to pin node positions

Open hexaeder opened this issue 1 year ago • 1 comments

This is a rework of #52. I changed the interface in the folloing way:

  • initialpos optionally allows for dictionarys now. So you can use something like Dict(3 => (1,2,3)) to set the inittial positon for the third vertex. Works with every pairs(..) comaptible container so the oldstyle arrays should also work.
  • pin argument is new and also accepts containers which support pairs(...) (mainly Vectors and Dicts). There are three options to use it:
    • 1 => (0.0, 1.0) overwrite the initial position for vertex 1 with (0.0, 1.0) and than pin it there
    • 2 => true/false pin (or explicitly not pin) vertex 2. Initial condition needs to be specified in initialpos argument, otherwise will be random
    • 3 => (true, false) only pin x coordinate of that point. y is free. The position at which to pin needs to be set using initialpos

I'd would be great if @claytonpbarrows and @thchr could give feedback on this. Would theis interface satisfy your invisoned workflows? Do you have the chance to try that PR? The tests in that package are not that great so i'd like to hear wether it works in real world code.

hexaeder avatar Oct 27 '22 16:10 hexaeder

Codecov Report

Merging #53 (b6edb03) into master (8eca84d) will increase coverage by 0.88%. The diff coverage is 98.82%.

@@            Coverage Diff             @@
##           master      #53      +/-   ##
==========================================
+ Coverage   97.44%   98.32%   +0.88%     
==========================================
  Files           8        8              
  Lines         470      538      +68     
==========================================
+ Hits          458      529      +71     
+ Misses         12        9       -3     
Impacted Files Coverage Δ
src/NetworkLayout.jl 95.58% <96.66%> (+1.14%) :arrow_up:
src/sfdp.jl 100.00% <100.00%> (+1.69%) :arrow_up:
src/spring.jl 100.00% <100.00%> (+2.22%) :arrow_up:
src/stress.jl 100.00% <100.00%> (+2.24%) :arrow_up:
src/shell.jl 100.00% <0.00%> (ø)
src/squaregrid.jl 100.00% <0.00%> (ø)
src/buchheim.jl 97.32% <0.00%> (+0.13%) :arrow_up:
src/spectral.jl 96.15% <0.00%> (+0.15%) :arrow_up:
... and 2 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Oct 27 '22 16:10 codecov[bot]

added docs on that: https://juliagraphs.org/NetworkLayout.jl/previews/PR53/#pin-Positions-in-Interative-Layouts

hexaeder avatar Oct 28 '22 10:10 hexaeder