# How to save 3d connectivity plot

**URL:** <https://mne.discourse.group/t/how-to-save-3d-connectivity-plot/10683>\
**Category:** Support & Discussions\
**Tags:** eeg, visualization, connectivity\
**Created:** [January 6, 2025, 12:38pm UTC](https://mne.discourse.group/t/how-to-save-3d-connectivity-plot/10683 "2025-01-06T12:38:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [January 6, 2025, 1:35pm UTC](https://mne.discourse.group/t/how-to-save-3d-connectivity-plot/10683/2 "2025-01-06T13:35:26Z")

</div>

Actually the process is described differently in this comment:

> [@How to save plot\_sensors\_connectivity()?](https://mne.discourse.group/t/how-to-save-plot-sensors-connectivity/4958/4):
>
> plot\_sensors\_connectivity() returns a 3D scene, so saving it to disk is a little bit more complicated. Here’s a fully reproducible working example: # %% import mne from mne\_connectivity import spectral\_connectivity\_epochs from mne.datasets import sample from mne\_connectivity.viz import plot\_sensors\_connectivity import matplotlib.pyplot as plt data\_path = sample.data\_path() raw\_fname = data\_path / 'MEG/sample/sample\_audvis\_filt-0-40\_raw.fif' event\_fname = data\_path / 'MEG/sample/sample\_audvis\_…

You should do something along the liens of

```python
# %%
# Do the actual plotting
connectivity_fig = plot_sensors_connectivity(
    epochs.info,
    con.get_data(output='dense')[:, :, 0]
)
# Take a screenshot of the 3D scene
screenshot = connectivity_fig.plotter.screenshot()

# The screenshot is just a NumPy array, so we can display it via imshow()
# and then save it to a file.
fig, ax = plt.subplots(figsize=(10, 10))
ax.imshow(screenshot, origin='upper')
ax.set_axis_off() # Disable axis labels and ticks
fig.tight_layout()
fig.savefig('connectivity.png', dpi=150)

```

Not sure if this will fix the issue you described above, though!

You may want to consider not using the Notebook 3d backend by first running:

```python
mne.viz.set_3d_backend("pyistaqt")

```

Richard

---

_[View the full topic](https://mne.discourse.group/t/how-to-save-3d-connectivity-plot/10683)._
