How to plot graphs nicely in Python [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
As part of my UI, I want to display graphs. The requirements are:
The graph must respond to events (e.g. mouse clicks).
If the graph is directed I want nice arrows.
If there are several edges spanning two nodes I want to display several edges.
The layout must be nice.
Now, there are two libraries: networkx and graphviz that can do some of those things. networkx can do 1 and (with some major hacks) 2. graphviz can do 2 and 3. 4 can be done by either library.
I would actually prefer to use graphviz because that would eliminate some dependencies; however, its inability to interact with matplotlib is a major problem.
Therefore, at the moment I am stuck with networkx, have to use a hack for arrows and abandon the idea of parallel edges.
My question is: Is this the state of the art or there is some other approach I could try?
Another question: Is it better to use a different language for graph visualization? For example, would it make sense to move all UI/visualization to JavaScript, while keeping Python only for data analysis?

Related

Is there any way to incorporate collisions in Tkinter? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Just wondering if there was any easy way to create collision events on a Tkinter canvas, as I am attempting to create a game in Tkinter.
I have seen some complex ways, but I was wondering if there was a simple solution.
I have been using Tkinter much longer than I have been using pygame, so I would prefer to stick to Tkinter.
There is no built-in collision detection, other than the find_overlapping and find_enclosed methods of the canvas which can find objects that overlap or are enclosed by a rectangular region (and the fact that you can get the rectangular bounding box of any object).
You can create your own with tkinter's bbox to check if the collisions happen or to make your desired effect. you can use other great words in that link to help you on get your collision engine be nice and running.

Drawing 3D animations in Python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Looking for a library or framework to aid me with the following:
I receive (x,y,z) vectors every few milliseconds telling me how an object is moving. I want to draw a point in the center of the screen to start, and have it move about - outlining its path - until I tell it to stop.
Being in 3D, I'd need some easy way to rotate or pan around this animation to get different perspectives.
Any recommendations for what to use in Python to accomplish this? Maybe a simple game/graphics library?
I believe that PyOpenGL will give you access directly to OpenGL from python.
You could use pyqtgraph. I have been using it for 3d graphics plots. It has a method scatterplot that is quick in updating a point on the screen. You can also access the view with azimuth and elevation to orbit around the object. http://www.pyqtgraph.org/documentation/3dgraphics/glscatterplotitem.html it uses pyopengl underneath, but its a fast and simple way to access those functions.

Create video with effects from image [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I am currently working on a project where I generate several images and then transform them into a video.
I am using OpenCV for the whole image processing thing, and especially cv.WriteFrame.
Even though it is working quite well, I would like to add some effects for image transition.
Simple things in fact, I would like the images to blend into each other to avoid the "violent" way it is currently done.
I also have problems with the fps in cv.WriteFrames (which is not accurate).
I searched on the internet without finding any library/utility to do that, so I started thinking about implementing it by myself. It would be quite a hassle though.
Would you know about an option to do such a thing?
I am open to any solution !
Thanks
To have a smooth transition you most likely have to put some extra frames between the 2 images. Those extra frames could be the 2 images progressively adding each other.
Usually opencv addWeighted is used to blend 2 images, it has parameters to set the weights.
addWeighted docs:
http://docs.opencv.org/modules/core/doc/operations_on_arrays.html#addweighted
Well, I've never worked with OpenCV, but if you want to do a fade in or fade out I could envision doing something like creating frames that have progressively more alpha transparency and adding them into the stack thats being written to the video file. Something like that could be done in just a few lines of code with PIL.

Interactive visualization of a graph in python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I have a program written in python using the module networkx to create a dynamic graph. It is a planer graph where the vertices remain constant but the edges change. Now I'm looking for a library that allows me to do two things, in a fast and quick manner preferably:
Drawing the vertices as the lattice points inside a rectangle, i.e.
Being able to select edges and vertices to change their color, position, weights, etc. as shown in the picture.
Thanks
For modest graph sizes, any good python graphics library should provide sufficient primitives to address this issue. For example, either Pyglet or PyGame would be suitable.

Python tools to visualize 100k Vertices and 1M Edges? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I'm looking to visualize the data, hopefully make it interactive. Right now I'm using NetworkX and Matplotlib, which maxes out my 8gb when I attempt to 'draw' the graph. I don't know what options and techniques exist for handling such a large cluster** of data. If someone could point me in the right direction, that'd be great. I also have a CUDA enabled GFX card if that could be of use.
Right now I'm thinking of drawing only the most connected nodes, say top 5% of vertices with the most edges, then filling in less connected nodes as the user zooms or clicks.
I don't have any experience with it, but tulip seems to be made for that.
Maybe PyOpenGL? It can be used together with wxPython.
Edit: Just tried the performance without any optimization, it takes 0.2s to draw 100k vertices and 4s to draw 1M edges.
You should ask on the official wxPython mailing list. There are people there that can probably help you. I am surprised that matplotlib isn't able to do this though. It may just require you to restructure your code in some way. Right now, the main ways to draw in wxPython are via the various DCs, one of the FloatCanvas widgets or for graphing, wx.Plot or matplotlib.
Have you considered graphviz? Not interactive although it was designed from the outset to handle very large graphs (although 1M edges may be beyond even it's capabilities).
There's a python module (pydot) that makes interacting with graphviz simple. Again, can't say for sure it'll scale to your levels. However, it should be easy to find out: installation of both is simple.
hth.
Have you considered using ParaView or VisIt? These are two interactive plotting programs which are designed to deal with and plot (very!) large data sets. They both also have a Python scripting interface, so you can automate/control your visualizations from within the Python interpreter.
Have you tried Gephi ?
I believe it scales very well.

Categories