rprueckl
(Robert Prueckl)
March 11, 2020, 12:01pm
1
Hi, I create (for quick testing and prototyping) some matplotlib windows from my segmenteditor effect (in the callback of the apply button) like described here:
I’ve just tried interactive plotting using matplotlib and it works fine for me on Windows. I just had to switch to WXAgg backend.
Setup:
pip_install("matplotlib wxPython")
Example interactive plot using matplotlib:
# Get a volume from SampleData and compute its histogram
import SampleData
import numpy as np
volumeNode = SampleData.SampleDataLogic().downloadMRHead()
histogram = np.histogram(arrayFromVolume(volumeNode), bins=50)
# Set matplotlib to use WXAgg backend
import matplotlib
matplotl…
Unfortunately, it is not possible to close the window after use. Any ideas why this happens? Thanks.
lassoan
(Andras Lasso)
March 11, 2020, 12:37pm
2
You can find various ways of plotting using matplotlib here: https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Using_matplotlib (including rendering in a static qt window, which can be surely closed without problems).