Converting matplotlib plots to Igor Pro graphs
In my experience dealing with PhD students, who know python well, their difficulty transitioning to Igor Pro for data visualization and analysis is that it's not easy to reproduce a matplotlib graph as an Igor Pro graph.
Although they realize the power of Igor Pro once the graph is displayed and we have cursors, zoom, pan, fitting, etc, the process of converting numpy data into Igor Pro and then displaying it is complex.
Python integration in Igor Pro 10 is great progress towards leveraging the benefits of both, but I would like an additional feature to convert a matplotlib graph into an Igor Pro graph. This could be implemented as
1. Standalone python module which exports a graph `pxp` given a matplotlib plot
2. In an Igor Pro 10 python session, a function in the `igorpro` module which, given a matplotlib plot object, generates the Window recreation procedure to create the corresponding graph
This is not an easy task as matplotlib is a huge module, but the conversion module could be built incrementally, focusing on the simplest types of plots first. For Python users who are adept with matplotlib, seeing the equivalent Igor Pro code to generate their plot would help them learn Igor Pro.
I would be happy to help develop this.
Here's an example, coded with Claude:
October 30, 2025 at 07:50 am - Permalink
That's an interesting idea, and probably doable for simpler graphs. I imagine you could at least get 'close enough' to the matplotlib graph as a starting point for making further modifications in Igor. As a potential alternative to saving Igor commands in an .itx file, you could also generate the graph directly from Python by taking advantage of the `igorpro.execute()` method, which allows you to execute any arbitrary Igor code. Here's a first pass at converting the graph you provided into a graph in Igor. Some things like the grid lines and legend are missing, but you get gist. You pass the 'fig' object in to the 'convert()' method after your code is finished running:
October 30, 2025 at 01:10 pm - Permalink