How can I create a frontend for matplotlib?

33k Views Asked by At

I feel that I should start this question by mentioning that I am a Chemical Engineer and not a trained programmer (but I am willing to learn).

I process a lot of spectra, which are essentially ASCII files with x,y coordinates produced by spectrometer specific software. A standard software used for analysis is Origin from Originlab but I find it is not user friendly, it has a lot more functions than I need and it is not free.

So I was hoping that there is a way to develop a frontend for matplotlib that allows to use matplotlib with a GUI. I want to be able to read in and plot data from ASCII files, zoom in and out in the plot, call scripts for things such as peak-detection and fitting functions where function specific parameters can be entered in the GUI.

I am simply puzzled where to start, so the question really is: What is the easiest way to develop a frontend/GUI for matplotlib that allows me to program the things that I mentioned above? Also, ultimately, a cross platform application would be nice because many in my group work in Windows.

2

There are 2 best solutions below

1
On BEST ANSWER

Check out also good examples from Eli Bendersky's website:

2
On

I'm not really sure what you're asking. Matplotlib already has an interactive GUI, if you call it from the Python shell or ipython, for example. You read in or construct your data, and when you call plot(), you get a zoomable window, from which you can save an image etc.

You can write your own routines for things like peak detection, and just call them interactively from the terminal. At the end of the day, as long as your function produces a set of (x, y) data, you can plot it interactively. The experience then is rather like Matlab. This is the way most of the scientists I know use matplotlib.

I would definitely try experimenting with this approach first, and seeing if it can meet your needs, before considering any kind of GUI programming - particularly if you are not a programmer by training.