How to create a very specific data diagram using Python - python

I would like to make a diagram in Python similar to the one shown below. From what I've seen so far, there is no a library that I could use directly. Can you suggest me where to start from, for example, would it be worth to improvise by stacking horizontally multiple subplots. Is there maybe a better approach?
Thanks!

I believe the name you're looking for is Parallel Coordinates Plot.
I'm sure Plotly supports it and there are tutorials online for other libraries as well.
Let me know if this helps.
Edit: and judging by this image from Plotly's docs your example image comes from there.

Related

Hosting interactive matplotlib plots online

I've built a simple program using matplotlib widgets to label a series of images for a classification task (see image below). My script adds the label and filename to a pandas dataframe depending on the button chosen in the window and moves on to the next image. When finished saves the whole dataframe to a csv.
Example Labelling Interface
I chose to build it rather than use something already out there as most programs seemed too complicated for the type of problem I have and I was hoping for a quick labelling solution - here it's just a simple click of a button and it's on to the next image.
My initial plan was to have a labelling program which I can host somewhere (something like AWS or Azure) in an app where others could simply go to a link and help with classifying some images, however I've found it hard to find anything on this.
I'm looking for general advice on if
a) hosting mpl interactive plots online is possible (if so any information would be greatly appreciated)
b) there's a simpler way to package this together to distribute to others without hosting online
c) there's a much better solution which I've somehow missed
Thanks in advance for any help!

Is there a way to draw a radar chart with Altair in python?

I have been using the Altair python API for a Data Visualization project, and everything went smoothly until I wanted to add a radar chart to my app.
I could not find anything on Altair's python API documentation about radar charts, however there seems to be an entry about that in Altair's core documentation but I couldn't access it.
I saw that plotly had that feature but I would really have liked using only one plotting framework...
Is there really no way to make a radar chart with Altair in python ?
This is currently not implemented in VegaLite, you can see the discussion in these two issues and open a new one if you think there is a good case to be made for radar charts:
https://github.com/vega/vega-lite/issues/3805
https://github.com/vega/vega-lite/issues/408
In Altair you might be able to hack something together by layering multiple mark_arc charts with a fillOpacity=0 and a colored stroke (although I don't think this will work since I can't see any way to get right of the lines going towards the middle.

Diagram to evaluate multiple metrics for different models

I want to use python to plot a diagram like the one in the image below. The purpose of it is to summarize the results of different models using multiple metrics to evaluate.
Is there a way to easily do it in Python, if not can someone refer me to the name of the diagram or a framework I can do it?
Thanks,
What you are trying to draw is called a radar chart.
matplotlib allows the drawing of such a chart.
The matplotlib example above is quite verbose and there may be other, simpler solutions out there. But hopefully, knowing the name of the type of chart will help you in your search. Best of luck!

Image Analysis in Bokeh?

I am looking to replace a MATLAB GUI used to do manual scoring of objects within a tif file. Someone recommended Bokeh to me. Is it possible to read a tif-file using any module and allow interactivity via Bokeh?
I have not used Bokeh (but I have kept an eye on it), so my answer is: Yes, you could probably use Bokeh for this.
But considering that you are replacing a MATLAB GUI, I think there might be an easier way. Bokeh creates plots that run in your web browser, which might not be what you want.
Instead, you could look into using matplotlib to do it.
The PyPlot API in matplotlib is very similar to the plot functions in MATLAB, and it supports creating interactive plots.
To read the TIFF file I would recommend looking into either PIL or OpenCV.

Scientific Plotting in Python

I have a large data set of tuples containing (time of event, latitude, longitude) that I need to visualize. I was hoping to generate a 'movie'-like xy-plot, but was wondering if anyone has a better idea or if there is an easy way to do this in Python?
Thanks in advance for the help,
--Leo
get matplotlib
The easiest option is matplotlib. Two particular solutions that might work for you are:
1) You can generate a series of plots, each a snapshot at a given time. These can either be displayed as a dynamic plot in matplotlib, where the axes stay the same and the data moves around; or you can save the series of plots to separate files and later combine them to make a movie (using a separate application). There a number of examples in the official examples for doing these things.
2) A simple scatter plot, where the colors of the circles changes with time might work well for your data. This is super easy. See this, for example, which produces this figure
alt text http://matplotlib.sourceforge.net/plot_directive/mpl_examples/pylab_examples/ellipse_collection.hires.png
I'd try rpy. All the power of R, from within python.
http://rpy.sourceforge.net/
rpy is awesome.
Check out the CRAN library for animations,
http://cran.r-project.org/web/packages/animation/index.html
Of course, you have to learn a bit about R to do this, but if you're planning to do this kind of thing routinely in future it will be well worth your while to learn.
If you are interested in scientific plotting using Python then have a look at Mlab: http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/mlab.html
It allows you to plot 2d / 3d and animate your data and the quality of the charts is really high.
Enthought's Chaco is designed for interactive/updating plots. the api and such takes a little while to get use to, but once you're there it's a fantastic framework to work with.
I have had reasonable success with Python applications generating SVG with animation features embedded, but this was with a smaller set of elements than what you probably have. For example, if your data is about a seismic event, show a circle that shows up when the event happened and grows in size matching the magnitude of the event. A moving indicator over a timeline is really simple to add.
Kaleidoscope (Opera, others maybe, Safari not) shows lots of pieces moving around and I found inspirational. Lots of other good SVG tutorial content on the site too.
You might want to look at PyQwt. It's a plotting library which works with Qt/PyQt.
Several of the PyQwt examples (in the qt4examples directory) show how to create "moving" / dynamically changing plots -- look at CPUplot.py, MapDemo.py, DataDemo.py.

Categories

Resources