Comments (4)
Thanks for your explanation.
I already set plot with the subplots_adjust method.
It turns out that I can adjust as I wish by using xlim/ylim appropriately.
I've also adjusted origin and scale to it so I'm pretty satisfied with it, I have way less coordinates issues than previously.
Thank you very much for the cool library and how easy it was to get info.
I guess you can close the issue, since behaviour seems to be pretty much what I wanted!
from netgraph.
It seems to me that netgraph (or networkx) auto determines a "frame" depending on the number of nodes it has to display.
Netgraph doesn't (or shouldn't) but it is built on matplotlib, and matplotlib by default adjusts the axis extents to the data limits of the objects plotted. As with any other matplotlib figure, you can set the x- and y-limits explicitly:
import matplotlib.pyplot as plt
import networkx as nx
from netgraph import InteractiveGraph
fig, ax = plt.subplots()
G = nx.complete_graph(10)
pos = nx.shell_layout(G)
ref = InteractiveGraph(G, node_layout=pos, ax=ax)
ax.set_xlim(-2, 2)
ax.set_ylim(-2, 2)
plt.show()
Does this solve your issue?
from netgraph.
As always, thank you for your (quick) answer.
I can see that it works, I just have to figure out how to properly set it to the matplotlib limits (there is currently still some margin). I initialized my Figure to figsize=(5, 3) so maybe I have to dig with this. All these features is just some extensive stuff I have added to my work but is not my core knowledge so it's not very intuitive to me.
By the way, setting the axe xlim/ylim impacted my graph "size", everything got way smaller than it was. Any clue why it did?
from netgraph.
I just have to figure out how to properly set it to the matplotlib limits (there is currently still some margin).
In matplotlib, all axes have a margin by default. You can adjust/remove the margins with:
fig, ax = plt.subplots()
fig.subplots_adjust(left=0, bottom=0, right=1, top=1)
By the way, setting the axe xlim/ylim impacted my graph "size", everything got way smaller than it was. Any clue why it did?
This is the expected behaviour, as in netgraph, all object sizes are given in data coordinates (times a constant factor of 0.01). This is in contrast to networkx, where node sizes and edge widths are in display coordinates.
from netgraph.
Related Issues (20)
- Issue with Node-Edge Connection when using Custom Shapes HOT 4
- Proper format for entering node_labels ? HOT 1
- Multipartite/Shell layouts not working if the number of nodes per layer/shell are not equal HOT 1
- Opacity behavior when removing vertex HOT 2
- Problems with very large graphs HOT 12
- Installation not working with python 3.11 HOT 5
- Minor documentation issues HOT 3
- ArcDiagram throws warning, does not label nodes, does not preserve node order. HOT 2
- Way to specify linestyle for edges? HOT 2
- Unable to use Community layout for Multi-Component graph? HOT 4
- Issues with MultiGraph HOT 14
- Not specifying node_edge_width when node_size is small causes node colours to not show up HOT 2
- How can I change the direction of a dot graph? HOT 1
- Strange Axis BoundingBox "diamond" HOT 3
- Combining interactive graphs with networkx subgraph functions? HOT 6
- (Suggestion) Handling div-by-zero HOT 1
- (Un)directed mixed graph HOT 5
- Changing arrow size while keeping edge width intact HOT 3
- self-loop labeling problem using EditableGraph HOT 2
- Embedding NetGraph EditableGraph in PyQt5 HOT 3
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 netgraph.