Skip to content

Add custom figures in SVG format to MNE reports #11617

Closed

Description

@nordme

Description of the problem

Hello!! Currently, mne.reports.add_figure() is broken when passing svg to image_format.

Steps to reproduce

import mne
import matplotlib.pyplot as plt
report = mne.Report(title='SVG Image Format Test')
fig, _ = plt.subplots()
report.add_figure(fig=fig, title='Attempting SVG Add', image_format='svg')
report.save('svg_test_report.html', overwrite=True)

Link to data

No response

Expected results

I expected the html report to show a plot of some sort. Instead it shows text.

Actual results

Screenshot from 2023-04-03 13-25-13

Additional information

mne.sys_info()
Platform Linux-5.19.0-38-generic-x86_64-with-glibc2.35
Python 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
Executable /home/erica/miniconda3/envs/dev_2023/bin/python
CPU x86_64 (24 cores)
Memory 62.7 GB

Core
├☑ mne 1.4.0.dev105+g686857c55
├☑ numpy 1.23.5 (OpenBLAS 0.3.21 with 12 threads)
├☑ scipy 1.10.1
├☑ matplotlib 3.7.1 (backend=QtAgg)
├☑ pooch 1.7.0
└☑ jinja2 3.1.2

Numerical (optional)
├☑ sklearn 1.2.2
├☑ numba 0.56.4
├☑ nibabel 5.0.1
├☑ nilearn 0.10.0
├☑ dipy 1.6.0
├☑ openmeeg 2.5.5
├☑ pandas 1.5.3
└☐ unavailable cupy

Visualization (optional)
├☑ pyvista 0.38.5 (OpenGL 4.6 (Core Profile) Mesa 22.2.5 via AMD Radeon RX 570 Series (polaris10, LLVM 15.0.6, DRM 3.47, 5.19.0-38-generic))
├☑ pyvistaqt 0.9.1
├☑ ipyvtklink 0.2.2
├☑ vtk 9.2.6
├☑ qtpy 2.3.1 (PyQt5=5.15.6)
├☑ pyqtgraph 0.13.2
├☑ mne-qt-browser 0.4.0
└☐ unavailable ipympl

Ecosystem (optional)
├☑ mne-bids 0.13.dev0
├☑ mne-connectivity 0.6.0dev0
└☐ unavailable mne-nirs, mne-features, mne-icalabel, mne-bids-pipeline

Activity

  1. hoechenberger commented on Apr 3, 2023

    @hoechenberger
    Member

    Whoops, seems we're escaping the content when we shouldn't. Would you like to work on this one?

  2. added 2 commits that reference this issue on Apr 12, 2023
    1ee080f
    edc1a20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions