Comments (3)
the node attribute radius is now called size. Ulf, could you explain why you chose to rename this? I like radius because I know what it means because it has a geometric defnition. size is rather ambiguous.
Good question. In v0.1 we ambiguously use size
and radius
, and I think I just wanted to clear this up by using simply one of them. But I agree that radius
is better.
when redrawing with matplotlib, overlapping nodes are joined such that strokes around nodes do not show anymore. was that intended? I think it makes the visualizations kind of awkward looking.
I fixed this in the latest commit 7964e1a. But I have a question: In v0.1, matplotlib rendering is simple because it just involves passing one collection of ellipses to the axis object, like so:
# v0.1: tools.py, line 429
circles = EllipseCollection(size,size,np.zeros_like(size),
offsets=XY,
units='x',
transOffset=ax.transData,
facecolors=node_colors,
linewidths=network_properties['nodeStrokeWidth']/width*axwidth,
edgecolors=network_properties['nodeStrokeColor'],
zorder=zorder
)
ax.add_collection(circles)
When I reused this code in v0.2, node edges became too wide, compared to those rendered in JS. This, I found, is because node edges are rendered on top of node fill in matplotlib, but behind in JS. The fix for this (in the latest commit) is to add nodes and node edges as separate objects, one at a time.
# v0.2: tools.py, line 423
for xy, r, c in zip(XY, size, node_colors):
circle = mpl.patches.Ellipse(xy, r, r, facecolor=c)
stroke = mpl.patches.Ellipse(
xy, r, r, facecolor=None,
edgecolor=network_properties['nodeStrokeColor'],
linewidth=network_properties['nodeStrokeWidth'] / width * axwidth
)
ax.add_artist(stroke)
ax.add_artist(circle)
This is obviously slower (but not devastatingly slow). What's your opinion on the fix? I agree that it's hacky, but I couldn't find another way to render node edges behind (or in front in JS).
from netwulf.
ah, cool! thanks for the quick reply.
Yeah, I remember that I encountered the same problem with edge widths once and I also remember that I had an approximate fix by scaling the edge widths, which doesn't really solve the problem.
I think adding nodes and edges one add a time was realllly slow back then for me which is why decided to live with the edge width problem. I'm not sure how much better matplotlib got at this by now.
from netwulf.
We could make it optional? Most users won't care.
So default is hack-scaling (as in v0.1, most users won't notice) and optionally you can do precise but slow rendering, one node at a time.
from netwulf.
Related Issues (20)
- label position examples are deprecated in the docs
- visualization with initially given positions is unfrozen when node properties are changed
- When nodes are dragged, labels stay on for that node HOT 6
- Getting Dataset does not have a key 'nodes' HOT 3
- Highlight connected nodes and edges HOT 2
- Problem with node attributes (specifically `bipartite') HOT 12
- Colouring nodes by property (e.g., degree) HOT 2
- Is netwulf available in anaconda? HOT 2
- ntwulf.visualize does not accept network as a dict HOT 5
- Netwulf changes the current working directory HOT 1
- Visualizing in google collab HOT 1
- Can't post visualization back to python HOT 2
- netwulf visualize ignores edge colors HOT 4
- is netwulf supports directed networkx ? HOT 4
- how to make .exe in Windows with pyinstaller and netwulf included [SOLVED] HOT 1
- some questions HOT 1
- Show edge labels
- nodes disappear when clicking on the nodes on a touchscreen HOT 2
- Canvas size ,self-loops ,large graphs? HOT 2
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 netwulf.