I'm wondering if it is possible to plot a vertex as image (loaded from a file or directly) in Igraph. Any ideas?
This is definitley possible in the R version of iGraph using the raster function, however a brief search did not reveal any implementation of this function in Python (it's not in the igraph documentation anyway).
If this is essential to your work, then I would consider switching to R, or possibly another tool such as Gephi. For Python, however, you might consider using something like pyvis. This package is small but powerful in terms of visualization. I've been playing around with it over the past few days and its very easy to display a graph with pictures as nodes, and it comes with the added benefit of providing interactive functioning. Take a look at the tutorial here, which will highlight what this package can provide.
Related
I need to create a complex image with lanes (like a cross functional flowchart). Is it possible to use Graphviz to automatically (based on a csv file) generate something like the picture below? If not, how can I achieve that?
Technically, Graphviz could probably do it, but the spline connecting the 12 triangular nodes would be the only "easy" part of the effort. For everything else, you would explicitly position/draw the nodes, swimlanes, and arrow edges. Ugh!
The dpic variant of the pic language is closer fit, but I don't think it supports rotated text
I'd look at TikZ, Asymptote, and/or straight SVG
I don't know what your input file looks like, but the mapping to your output language will be challenging. Good luck.
You could probably render some of it in Graphviz, such as in the cluster example, but Graphviz isn't really suited to this type of diagram. Its strength is directed graphs and hierarchical info.
Have a look at some of the declarative graphics libraries such as Altair or Matplotlib or Plotly. There is various levels of support for plotting axes in the style of lanes, then the rest is mostly textual annotations.
I am trying to generate a network graph for 200+ nodes and 300+ edges using networkx using python from a file. I was able to generate and plot the graph using matplotlib in my Juypter Notebook, but its not looking good and nodes are so tightly packed.
Is there any other python package help to generate network graph ??.
My aim is to generate graph for whole data set so that I can find dependency between nodes.
If nodes being too close together is the issue, try using the draw_spring()function of networkx.
https://networkx.github.io/documentation/networkx-2.0/reference/generated/networkx.drawing.nx_pylab.draw_spring.html#networkx.drawing.nx_pylab.draw_spring
It simulates what would happen if each edge were a spring and the network were picked up and spun around, seperating the nodes, especially the ones which are not connected via many paths.
If this does not work initially, you can use the parameters of the function that draw_spring() wraps, the spring_layout() function. Try adjusting the k value parameter. This should allow you to manipulate the rough distance between nodes.
https://networkx.github.io/documentation/networkx-2.0/reference/generated/networkx.drawing.layout.spring_layout.html#networkx.drawing.layout.spring_layout
Alternatively, there are additional draw functions you might find more useful than draw_spring(). You can find them in the draw section here: https://networkx.github.io/documentation/networkx-2.0/reference/drawing.html
I can recommend using Netwulf. Input a networkx.Graph object to netwulf.visualize, and launch the visualization in a new browser window. The result and data can be posted back to Python.
Disclaimer: I co-author Netwulf.
I need to create a GUI for graph construction ("graph" as an abstract representation of a set of objects, not a visual representation of data). The interface will provide a choice of ~5 vertex types and of ~5 edge types. Each vertex will have two data fields: a text label and a file name, which need to be easily editable.
I'm familiar with igraph and have a lot of code written in it. I will use igraph to manipulate the graphs created with this GUI.
Since this will be my first GUI, I'm completely ignorant of what tools are available. Can you please suggest a free library, knowing that eventually the program will need to work on Windows?
EDIT
it seems from the answers I get that I wasn't clear enough. I'm not looking for a way to visualize a graph, but rather for a way to visually create one. By visually, I mean not needing to manually create text files or writing code.
Take a look at xdot.py.
From the homepage
xdot.py is an interactive viewer for graphs written in Graphviz's
dot language.
It uses internally the graphviz's xdot output format as an
intermediate format, and PyGTK and Cairo for rendering.
xdot.py can be used either as a standalone application from
command line, or as a library embedded in your python application.
I like networkx,
from networkx import draw, Graph
from pylab import show
g = Graph()
g.add_edges_from([(1,2),(1,3),(2,4),(2,5)])
draw(g)
show()
which gives,
The only quirk is the requirement for matplotlib to get builtin plotting to work.
If you use python, I think PyQt is a good selection.
What you have to install is listed below:
install Python from here
install PyQt4 from here
But it takes many lines to write GUI application,
it is sometimes better to generate an image to display with image viewer.
I am trying to draw a dynamic graph which I want to control ( moving edges or nodes, update data of edges or nodes, click on edge to show more information...).
I have tried several programs and packages like prefuse, networkx and also processing.
But with these, we cannot control edges (onClick listener for exemple) we can just control nodes.
I have also a little problem because I am using python to parse the data and binding languages is a new thing for me , I have tried Jython with processing which was really slow...
I will appreciated any help of you
Thank you!
Take a look at this example
http://developer.qt.nokia.com/doc/qt-4.8/graphicsview-elasticnodes.html
You should be able to make the same using Python Binding for C++/Qt aka PyQt or Pyside. It should run and render much faster.
I am trying to detect a marker in a webcam video feed and overlay it with a 3d object - pretty much exactly like this: http://www.morethantechnical.com/2009/06/28/augmented-reality-with-nyartoolkit-opencv-opengl/
I know artoolkit is the best module for this, but I was hoping to just use opencv in python since I dont know nearly enough c/c++ to be able to use artoolkit. I am hoping someone will be able to get me on the right track towards detecting the marker and determining its location and orientation etc since I have no idea how best to go about this or what functions I should be using.
OpenCV doesn't have marker detection / tracking functionality out of box. However it provides all algorithms needed so it's fairly easy to implement your own one.
The article you are referring to uses OpenCV only for video grabbing. The marker detection is done by NyARToolkit which is derived from ARToolkit. NyARToolkit have versions for Java, C# and ActionScript.
ARToolkit is mostly written in plain C without using fancy C++ features. It's probably easier to use than you thought. The documentation contains well explained tutorials. e.g http://www.hitl.washington.edu/artoolkit/documentation/devstartup.htm
The introductory documentation can help you understand the process of marker detection even if you decide not to use ARToolkit.
I think the most used way to perform marker detection using python and open CV is to use SURF Descriptors.
I have found very useful this video and the linked code you can find in this page. Here you can download the code. I don't know how to overlay it with a 3d object but I'm sure you can do something with pygame or matplotlib.