How can I create a frontend for matplotlib?

痞子三分冷 提交于 2019-11-30 06:41:46

问题


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.


回答1:


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

  • matplotlib with PyQt GUIs
  • More PyQt plotting demos
  • matplotlib with wxPython GUIs



回答2:


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.



来源:https://stackoverflow.com/questions/5285912/how-can-i-create-a-frontend-for-matplotlib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!