File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
src/easydiffraction/plotting/plotters Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change 1212 display = None
1313 HTML = None
1414
15- from easydiffraction .utils .utils import is_notebook
1615from easydiffraction .utils .utils import is_pycharm
1716
1817from .plotter_base import SERIES_CONFIG
@@ -107,21 +106,20 @@ def plot(
107106
108107 # Show the figure
109108
110- # This can lead to warnings in Jupyter notebooks:
111- # WARNING: skipping unknown output mime type: application/vnd.plotly.v1+json [mystnb.unknown_mime_type]
112- if is_notebook () or is_pycharm () or display is None or HTML is None :
113- fig .show (config = config )
109+ # The standard `fig.show()` method method triggers the following
110+ # warning during the DMSC Summer School 2025 book build process:
111+ # WARNING: skipping unknown output mime type:
112+ # application/vnd.plotly.v1+json [mystnb.unknown_mime_type]
113+ # So, instead, we will use `pio.to_html()` to convert the figure
114+ # to HTML and keep `fig.show()` in PyCharm only.
114115
115- # If IPython is available, we can convert the figure to HTML and
116- # display it in the notebook.
116+ if is_pycharm () or display is None or HTML is None :
117+ fig . show ( config = config )
117118 else :
118- # Convert figure to HTML
119119 html_fig = pio .to_html (
120120 fig ,
121121 include_plotlyjs = 'cdn' ,
122122 full_html = False ,
123123 config = config ,
124124 )
125-
126- # Display it in the notebook
127125 display (HTML (html_fig ))
You can’t perform that action at this time.
0 commit comments