Matplotlib is a popular package for generating graphs in Python. The goal of this project is to provide a tool to convert a graph generated by matplotlib into a graph that can be modified in Igor Pro. Igor generally has a more powerful and intuitive user interface for graph customization, and it also integrates directly with the data source: changes in the source data are automatically reflected in the graph without having to manually regenerate it.
This project started from an Igor user's feature request: https://www.wavemetrics.com/forum/igor-pro-wish-list/converting-matplotlib-plots-igor-pro-graphs.
Note, as this is an actively developed project, many of matplotlib's features may not yet be convertible to Igor graphs. We're starting with simple line plots and moving forward from there.
This project can only be run from inside Igor Pro, and you need an active Igor Pro 10 license.
The project contains a helper Igor procedure file found in ipf/openWorkspace.ipf. You can run the function:
openWorkspace(String environmentName)to automate the Python setup that needs to happen to run the conversion tool. It will create the named virtual environment in the project folder, activate it, and install the dependencies found in requirements.txt. If the environment already exists, it will just activate the environment and attempt to re-install the dependencies.
After the virtual environment is running, you can execute:
PythonFile file = "src/igorplot.py"which will run the example test plot conversion that is found in src/testplot.py.
For normal usage, you would first generate your matplotlib figure, and then call
igorplot.convert(figure)to convert and display the equivalent graph in Igor.