# Using matplotlib in Slicer jupyter notebook

**URL:** <https://discourse.slicer.org/t/using-matplotlib-in-slicer-jupyter-notebook/8310>\
**Category:** Development\
**Tags:** feature\
**Created:** [September 5, 2019, 2:31pm UTC](https://discourse.slicer.org/t/using-matplotlib-in-slicer-jupyter-notebook/8310 "2019-09-05T14:31:09Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 5, 2019, 3:40pm UTC](https://discourse.slicer.org/t/using-matplotlib-in-slicer-jupyter-notebook/8310/2 "2019-09-05T15:40:20Z")

</div>

You need to choose a suitable matplotlib backend. See example here:

> [@Use full power of Python in Slicer](https://discourse.slicer.org/t/use-full-power-of-python-in-slicer/7162/5):
>
> 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…

Note that you can also use Slicer’s built-in interactive plotting features. The advantage of Slicer plots is that they are directly connected to MRML nodes: if you update a value in a table node then the plot is updated immediately (and you can drag-and-drop points in the plot to change values in a table).

---

_[View the full topic](https://discourse.slicer.org/t/using-matplotlib-in-slicer-jupyter-notebook/8310)._
