Hosting interactive matplotlib plots online - python

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!

Related

Mark an area within a plot in Jupyter Notebook and extract the data/ brushing

We are using Jupyter Notebooks and would like to make our graphical data analysis more interactive: we would like to select an area
in a plot and be able to easly access/ extract the data. We saw that you can do such things with e.g. bokeh. However, we are searching for something "simpler", just a few python code lines any scripting beginners can grasp easily.
We feel that others probably solved this issue many times and we just don't know the right buzz words for searching.
Can you help us searching?
Again, marking and data extracting is the main goal. Additional stretch goals would be:
If you mark some data in one plot, they should also marked in all other plots.
We could use seaborn for plotting.
Thank you in advance and best regards.

How to programmatically delete a specific plot in mayavi

I made a bunch of plots using stuff like
plot_to_delete_later = mlab.points3d(...)
I want to remove this later on, but keep the other plots. I can do this in the GUI (see image), but can't seem to find the trick to doing it in code.
Any help much appreciated.

How to create a very specific data diagram using 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.

How do I extract the GUI plotting part of this existing FOSS app (itrade)

I have recently downloaded itrade, and so far I have been unable to get it to run (dependency on wxaddons amongst other things). Also, the project seems to have been disbanded since 2008.
Last but not the least, the project contains a lot of functionality which I just don't need.
All I require is the functionality to produce a graph similar to that shown on the Journalier tab in the image below; and to be honest, I don't even need all of the additional indicators shown in the image. I will be happy enough with the (1st) top chart and the (2nd) midle sub chart, without all the indicators.
I have had a look at the code, and since I am not familiar with wxPython etc, I am finding it difficult to locate the code that is responsible for producing the image below.
I'd be grateful if anyone with either wxPython or itrade experience could outline the steps needed (or explicitly state how) to extract only the section of the code that produces the image below. The objective being that I can read in data from a CSV file, and pass it to the new script, to display a GUI plot similar to the one shown below.
If you really have to do this, this would be my approach:
Find the code that produces these tabs
Find the code that produces the visual graph for the Journalier tab
Find the code where the data is produced that is displayed in the graph
Find the code that passes the data to the graph and how it is processed before being displayed
Extract the necessary pieces of logic to produce and process the data
Use a plotting library to create the graph; it's easier to hook a plotting library into your application than to try and integrate this particular piece of visual code. Especially if you don't need most of the visual indicators.

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