Comments (2)
The way tangets work for "normal" edges is not directly extendable to self edges. The tanget is only the directional information. The placement of bezier helper points depends on the base distance between src and dst vertices. This makes sense because you can achive a similar look regardless of distance of the vertices.
g = SimpleGraph(6)
add_edge!(g, 1, 2); add_edge!(g, 3, 4);add_edge!(g, 5, 6)
fig, ax, p = graphplot(g; layout=_->([0,0],[1,0],[0,1],[2,1],[0,2],[3,2]),
tangents = (Point2(1,1), Point2(1,-1)))
ax.aspect = DataAspect()
GraphMakie.plot_controlpoints!(ax, p)
For self edges, where src and dst are the same position, all 4 positions will be identical and there is no loop.
So what you need there is some kind of absolute information in data space, the problem is not solvable purely with tangets
and tfactor
. Enter: selfedge_size
, selfedge_width
and selfedge_direction
. The direction is not the outgoing direction, it is responsible for the direction of the center of the loop. The width is given in radians and tell the algorithm the angle between outgoing and incoming arc (one is width/2 left of direction
, one is width/2
right of direction
). The size
just pushes the bezierpoints further out until the arc crosses direction at that distance from the node.
using GraphMakie.NetworkLayout: SquareGrid
g = SimpleGraph(4)
for i in 1:nv(g)
add_edge!(g, i, i)
end
fig, ax, p = graphplot(g; layout=SquareGrid(),
selfedge_direction = Point2[(0,1), (1,1), (-1,-1), (0, -1)],
selfedge_width = [pi/5, pi/4, pi/3, pi/2],
selfedge_size = [1, 0.75, 0.5, 0.25])
ax.aspect = DataAspect()
GraphMakie.plot_controlpoints!(ax, p)
I think this is the minimum set of required parameters to specify whatever selfloop you want as long as it is symmetric arround direction
and represantable as single cubic bezier spline. Not sure what what else to achieve with tangets.
Waypoints is a different story though, that should totally work. Should be an easy fix though: the selfedge branch should be only hif if there is no waypoint
data for the selfedge.
from graphmakie.jl.
@hexaeder Thank you for your explanation! I can add a PR to support waypoints on self loops if that is something you're ok with adding. Let me know
from graphmakie.jl.
Related Issues (20)
- curve_distance & curve_distance_usage observable not updating figure
- Precompilation stuck on Julia 1.9 HOT 6
- handle overlapping `nlabels` HOT 6
- node_color and node_marker only accept Symbol HOT 5
- Performant graph plotting and benchmarking HOT 4
- Element-wise `automatic` configuration HOT 1
- Deleting a plot doesn't remove all listeners HOT 2
- Mixing directed and undirected edges HOT 2
- Add padding around graphplot to accommodate node size. HOT 2
- `node_attr` broken using Makie v0.19.11 HOT 1
- Slow start HOT 2
- Setting node size with ilabel
- Improve Reftests HOT 1
- provide convenience function for MetaGraphsNext HOT 7
- KeyError: key :textsize not found when running doc examples HOT 2
- UndefVarError: `mouse_selection` not defined HOT 5
- arrow_shift = :end works poorly with larger edge width HOT 6
- bounding box cuts off nodes HOT 3
- `pick` one `LineSegments` returns odd index HOT 2
- Dynamic Layout + Interaction.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphmakie.jl.