Hopefully this question isn't too opinion based. If it is, can you point me in the right direction for this question.
I am hoping to create something simple to visualize a twitter network that has been defined with networkx. What are the best available visualization tools for this? I would like to have something along the lines of, I run a script and get display a png or some image of the network that isn't too cluttered. I would definitely like to differentiate between usernames and hashtags and possibly color by community or something along those lines.
I haven't started anything yet other than playing with the built in networkx drawing which is limited and networkx doesn't even recommend. The tools I've found in my search include plot.ly, gephi, d3.js, and cytoscape. Plot.ly is proprietary so I'd like to stay away from it. D3.js seems pretty cool. I plan on using it eventually for some interactive graphs, but I hear there are performance issues and limitations to hundreds of nodes vs thousands of nodes. Also I'm not familiar with javascript at all. Gephi and cytoscape aren't really programmatic. They are nice, but require a human element.
Does anything already exist that meets my needs? Is the human element required to get decent looking output? I can get okay results with the built in networkx drawing, but it requires significant tweaking for each case (remove overlapping, setting up a half decent layout, etc...). Also the fact that networkx mentions they may drop support for drawing in the future doesn't help.
No need to use Javascrip. Bokeh is a Python library for D3.
You can also consider NodeBox if on OSX or NetworkX Viewer, but probably what you are looking for is Graph-Tool.
Related
I want to make a GUI for a program I am writing, and I would like the program to have an interactive graph (graph here meaning a network of nodes and edges). I would like users to use the GUI to create nodes and alter their properties, and run calculations on the graph (with the code I have written). I also want different clusters of nodes to be expandable and collapsible when you click on them, or maybe take you to a different window where you can see node substructure. It would also be nice if clicking on a node also let you alter its properties. Any recommendations on how to use this would be greatly appreciated.
There is no programs/libraries for Python that allow you to do everything you want.
You can check these libraries:
bokeh:
Has good interactive visualizations
Built on top of D3.js
It is only visualization library so it has nearly no tools to manipulate the graph
networkx:
Incredibly large amount of different algorithms
Has pretty good non-interactive visualization
Pure Python-written so rather slow
igraph:
Has good amount of algorithms
The core is written on C so it is really fast
Has an average non-interactive visualization
Python has no stable popular libraries that can allow you to create nodes and manipulate the graph in the interactive GUI. Things you want need very complex software and Python just has no this software.
But there is good news - most things you need can be done with Gephi software (written on Java). You can also check Cytoscape software - maybe it can fit you a bit more than Gephi.
I am working on a navigation system and want to visually check results of my calculations. (Dijkstra, A*, etc.)
What are my options without getting into Google Maps API, Javascript, etc.?
For the most part every query gives me a list of coordinates:
[[53.4704344, 9.9145282], [53.4704483, 9.9152652], [53.4704704, 9.9164389], [53.4704818, 9.9169074]]
Right now I build GeoJSON linestring I paste into GeoJSONLint.com which starts getting annoying.
Without knowing the requirements, two things that immediately come to mind are:
matplotlib maps: http://matplotlib.org/basemap/users/examples.html
GeoJSON on http://gist.github.com: https://github.com/blog/1576-gist-meets-geojson
I would probably use gist first, as it's all git-able, zoomable, shows streets, etc.
Which is better probably depends on your data (especially the spatial scale).
I want to develop a 3D file viewer in kivy and python that reads and displays .asc mesh files of the format:
x1,y1,z1
x2,y2,z2
........
xi,yi,zi
What I have thought so far is to use a method similar to beginShape() of Processing so as to begin drawing a 3D shape then use a for-loop to append each point respectively.
I have also found that kivy example which parses .obj files and then displays them. Do you have any ideas on how can I make a similar ascparser and try to display my files?
Any help is greatly appreciated
I have also found that kivy example which parses .obj files and then displays them. Do you have any ideas on how can I make a similar ascparser and try to display my files?
Your best strategy at the moment is probably to read the objparser and try to understand what it is doing. The important thing is building a list of points and normals, which are passed to opengl via a Mesh with a custom vertex_format and custom shaders. In principle it wouldn't be very hard to do the same thing for your own filetype just by comparison with the .obj code, though you will need some understanding of what's going on (you can read about opengl and read the kivy source, if you haven't already) to make significant changes.
This is really an advanced topic right now, Kivy has very few pre-built wrappers to 3d opengl rendering. The backend is fully capable (so the 3d rendering example isn't that complex, for instance), but you probably do need some understanding of what's going on to accomplish things like your own task.
There are also a few other examples of 3d rendering in Kivy, which you might find helpful. nskrypnik has several repositories doing just this (see kivy-trackball, kivy-3dpicking, kivy-rotation3d), and seems to have begun implementing a proper 3d api in the kivy3 repo, though this is not complete and I suggest it as something you can learn about by reading, not something that can necessarily do what you want right now. The other nice example I've seen is a 3d inspector POC by tito, though it's just a proof of concept and not a polished product.
I'm interested in using python to make diagrams representing the size of values based on the size of squares (and optionally their colour). Basically I'm looking for a way to make overviews of a bunch of values like the good old program windirstat does with hard-drive usage (it basically makes a big square representing your harddrive and then smaller squares making up the area inside of it representing different programs, the bigger the square the larger the file, colour indicates the type of file). I'm fairly familiar with matplotlib, and I don't think it's possible to do something like this with it. Is there any other python package that would help? Any suggestions for something more low level if it's not? I guess I could do it manually if I could find a way to draw the boxes programatically (I don't really care about the format, but the option to export SVG as well as PNG would be nice).
Ultimately, it would be nice to have it be interactive like windirstat is, where if you were to hover over a particular square you get more information on it, and if you clicked on it maybe you'd go in and see the makeup of that particular square. I'm only familiar with wxpython for GUI stuff, not sure if it could be used for something like this. For now I'd be happy with just outputting them though.
Thanks a lot!
Alex
Edit:
Thanks guys, both your answers helped a lot.
You're looking for Treemapping algorithms. Once implemented, you can transform the output (which should be rectangles) into plotting commands to anything that can draw layered rectangles.
Edit:
More links and information:
If you don't mind reading papers, the browser-based d3 library provides for 'squarified' treemaps (js implementation). They reference this paper by Bruls, Huizing, and van Wijk. (This is also citation 3 on the wikipedia article)
I'd search on the algorithms listed on the linked Wikipedia article. For instance, they also link to this article, which describes an algorithm for "mixed treemaps". The paper also includes some interesting portions at the end describing transformations into other-than-rectangular shapes.
Squarified certainly appears to be the most common variety around. The above links should give you enough to work towards a solution or, even, directly port the d3 implementation. However, the cost of grokking d3's model (which is something like a declarative form of jQuery) may be somewhat high. At first glance, though, the implementation appears relatively straightforward.
Squaremap does this. I haven't used it (I only know it from RunSnakeRun) and its documentation is severely lacking, but it seems to work.
After searching SO and multiple articles I haven't found a solution to my problem.
What I am trying to achieve is to load 20,000 markers on Google Maps.
R-Tree seems like a good approach but it's only helpful when searching for points within the visible part of the map. When the map is zoomed out it will return all of the points and...crash the browser.
There is also the problem with dragging the map and at the end of dragging re-running the query.
I would like to know how I can use R-Tree and be able to achieve the all of the above.
As noted, R-Tree won't help you when you're looking at a zoomed-out view. This problem is often addressed by marker clustering, because showing 20,000 points in a browser window isn't that useful.
Marker Manager is an open source javascript library which addresses this, but there are others.
With a very great number of markers, you may need to look at server-side clustering, (where R-Tree may come in handy!). Here is one discussion of it, and its google cache because link is dead at time of writing.
If you don't want to bother with clustering, then just terminate your marker list at a preset number, maybe a few hundred (which you can determine by usability testing), and display some indication that there are more available as you zoom in