Skip to content

Commit d11c622

Browse files
enryHsayalaruano
andauthored
🔧 configure the plotly renderer on Read The Docs (#18)
* 🔧 configure the plotlly renderer on Read The Docs * ⚡ see if requirejs is still needed * 🔧 setup was moved to conf.py * 🎨 remove unused import --------- Co-authored-by: Sebastián Ayala Ruano <[email protected]>
1 parent ff7929f commit d11c622

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

docs/api_examples/scatter_plot.ipynb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,8 @@
293293
"source": [
294294
"# Imports\n",
295295
"import pandas as pd\n",
296-
"import plotly.io as pio\n",
297296
"\n",
298-
"from vuecore.plots.basic.scatter import create_scatter_plot\n",
299-
"\n",
300-
"# Set the Plotly renderer based on the environment\n",
301-
"pio.renderers.default = \"notebook\""
297+
"from vuecore.plots.basic.scatter import create_scatter_plot"
302298
]
303299
},
304300
{

docs/api_examples/scatter_plot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,9 @@
7676
# %%
7777
# Imports
7878
import pandas as pd
79-
import plotly.io as pio
8079

8180
from vuecore.plots.basic.scatter import create_scatter_plot
8281

83-
# Set the Plotly renderer based on the environment
84-
pio.renderers.default = "notebook"
85-
8682
# %% [markdown]
8783
# ### 0.3. Create sample data
8884
# We create a synthetic dataset that contains simulated gene expression values, p-values, regulation status, and significance scores for 8 genes across two cell types.

docs/conf.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#
1313
import os
1414
from importlib import metadata
15+
from pathlib import Path
1516

1617
# -- Project information -----------------------------------------------------
1718

@@ -49,7 +50,7 @@
4950
# Plolty support through require javascript library
5051
# https://myst-nb.readthedocs.io/en/latest/render/interactive.html#plotly
5152
html_js_files = [
52-
"https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"
53+
# "https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.7/require.min.js"
5354
]
5455

5556
# https://myst-nb.readthedocs.io/en/latest/configuration.html
@@ -133,7 +134,11 @@
133134
# https://github.com/readthedocs/readthedocs.org/issues/1139
134135

135136
if os.environ.get("READTHEDOCS") == "True":
136-
from pathlib import Path
137+
# Set the Plotly renderer to notebook for ReadTheDocs (visualize plotly figures
138+
# in the documentation) - needed for plotly6
139+
# Plotly normally decides itself fine which renderer to use, so keep it to RTD
140+
# see https://plotly.com/python/renderers/#setting-the-default-renderer
141+
os.environ["PLOTLY_RENDERER"] = "notebook"
137142

138143
PROJECT_ROOT = Path(__file__).parent.parent
139144
PACKAGE_ROOT = PROJECT_ROOT / "src" / "vuecore"

0 commit comments

Comments
 (0)