[Matplotlib-users] wxmplot 0.9.38: interactive plotting with wxPython + matplotlib

Hello matplotlib users,

wxmplot 0.9.38 is now available and can be installed with pip install wxmplot.

Docs are at https://newville.github.io/wxmplot/ and code at https://github.com/newville/wxmplot/.

I suspect many people here are not aware of this module that combines wxPython and matplotlib. I also think that some of you may find it very useful for making 2D line plots and image displays because the displays created are highly configurable and interactive.

With 0.9.38, interactive plotting from the Python command line (that is, from a plain Python terminal or a Jupyter qtconsole, notebook, or Juptyerlab) can be done with:

>>> import wxmplot.interactive as wi
>>> import numpy as np
>>> x = np.linspace(-5, 5, 101)
>>> wi.plot(x, np.sin(x), label='sine')

At first look, the results are similar to pyplot.plot() : a new Plot Window with the 2D Line Plot. From this window, not only can the user zoom in, adjust the margins, and save an image as with the Navigation Toolbar, but they can also change the styling/theming, labels and titles, configure the legend, and so on. They can also change the color, marker, linewidth, label, and style of each trace. With the legend displayed, clicking on a legend label will toggle whether the corresponding trace is displayed. Additional functions such as wi.plot_text(), wi.plot_marker(), and wi.plot_axhline() allow the user to add annotations to the 2D line plot.

For image displays, wi.imshow(image_data) will display a false-color image of data, similar to pyplot.imshow(image_data), but with widgets, menu items, and keyboard shortcuts to allow the user to rotate, flip, or smooth the image, change color tables and contrast thresholds, display as a contour map, draw a scalebar, and show slices through the image.

The wxmplot.interactive module does not use a blocking show() function - the results are drawn immediately and are interactive, and the shell is not frozen while the plot is displayed. This means that from the Python shell, the user can additional traces to an existing plot, replace the current plot, or draw to a second (or more) separate Plotting or Image Display windows. When run with python myscript.py, a script that uses the wxmplot.interactive functions will show the displays, and these will persist (and be interactive) until closed. That is, the script will not finish and kill the displays until all displays are closed or until the script is explicitly killed with Ctrl-C.

There are some specialty displays available (see examples), but there are many aspects of matplotlib that have no equivalent in wxmplot. Still, I invite anyone interested to try out the basic plotting and image display as I think some of you may find it very useful for exploratory data analysis.

Wxmplot 0.9.38 uses and MIT license and supports Python 2.7, 3.5, 3.6, and 3.7, and requires matplotlib 2.0+, wxPython 4.0.2+, numpy, and six. Support for Python 2 will be dropped for the next release.

Feedback, suggestions, and improvements are most welcome.
Cheers,

–Matt Newville

Hello Matt,

Thanks for the info :).

I do not know what core devs may think about the idea but maybe it could
be worth opening a ticket (or even a PR ;)!) for adding an entry about
wxmplot on the [third-party packages
webpage](https://matplotlib.org/thirdpartypackages/index.html).

Best,
Adrien

···

Le 29/08/2019 à 16:16, Matt Newville a écrit :

Hello matplotlib users,

wxmplot 0.9.38 is now available and can be installed with `pip install
wxmplot`.
Docs are at WXMPLOT: plotting widgets for Python — WXMPLOT: interactive plotting with Python and code at
GitHub - newville/wxmplot: wxPython plotting widgets using matplotlib.

I suspect many people here are not aware of this module that combines
wxPython and matplotlib. I also think that some of you may find it very
useful for making 2D line plots and image displays because the displays
created are highly configurable and interactive.

With 0.9.38, interactive plotting from the Python command line (that is,
from a plain Python terminal or a Jupyter qtconsole, notebook, or
Juptyerlab) can be done with:

>>> import wxmplot\.interactive as wi
>>> import numpy as np
>>> x = np\.linspace\(\-5, 5, 101\)
>>> wi\.plot\(x, np\.sin\(x\), label='sine'\)

At first look, the results are similar to `pyplot.plot()` : a new Plot
Window with the 2D Line Plot. From this window, not only can the user
zoom in, adjust the margins, and save an image as with the Navigation
Toolbar, but they can also change the styling/theming, labels and
titles, configure the legend, and so on. They can also change the
color, marker, linewidth, label, and style of each trace. With the
legend displayed, clicking on a legend label will toggle whether the
corresponding trace is displayed. Additional functions such as
`wi.plot_text()`, `wi.plot_marker()`, and `wi.plot_axhline()` allow the
user to add annotations to the 2D line plot.

For image displays, `wi.imshow(image_data)` will display a false-color
image of data, similar to `pyplot.imshow(image_data)`, but with widgets,
menu items, and keyboard shortcuts to allow the user to rotate, flip, or
smooth the image, change color tables and contrast thresholds, display
as a contour map, draw a scalebar, and show slices through the image.

The `wxmplot.interactive` module does not use a blocking `show()`
function - the results are drawn immediately and are interactive, and
the shell is not frozen while the plot is displayed. This means that
from the Python shell, the user can additional traces to an existing
plot, replace the current plot, or draw to a second (or more) separate
Plotting or Image Display windows. When run with `python myscript.py`,
a script that uses the `wxmplot.interactive` functions will show the
displays, and these will persist (and be interactive) until closed. That
is, the script will not finish and kill the displays until all displays
are closed or until the script is explicitly killed with Ctrl-C.

There are some specialty displays available (see examples), but there
are many aspects of matplotlib that have no equivalent in wxmplot.
Still, I invite anyone interested to try out the basic plotting and
image display as I think some of you may find it very useful for
exploratory data analysis.

Wxmplot 0.9.38 uses and MIT license and supports Python 2.7, 3.5, 3.6,
and 3.7, and requires matplotlib 2.0+, wxPython 4.0.2+, numpy, and six.
Support for Python 2 will be dropped for the next release.

Feedback, suggestions, and improvements are most welcome.
Cheers,

--Matt Newville

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@python.org
Matplotlib-users Info Page

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@python.org
https://mail.python.org/mailman/listinfo/matplotlib-users