Skip to content

Commit e2e45b1

Browse files
committed
Implementation of bokeh backend.
1 parent 4628a47 commit e2e45b1

17 files changed

+284
-20
lines changed

.tools/envs/testenv-linux.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dependencies:
2020
- pandas # run, tests
2121
- plotly>=6.2 # run, tests
2222
- matplotlib # tests
23+
- bokeh # tests
2324
- pybaum>=0.1.2 # run, tests
2425
- scipy>=1.2.1 # run, tests
2526
- sqlalchemy # run, tests

.tools/envs/testenv-nevergrad.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dependencies:
1818
- pandas # run, tests
1919
- plotly>=6.2 # run, tests
2020
- matplotlib # tests
21+
- bokeh # tests
2122
- pybaum>=0.1.2 # run, tests
2223
- scipy>=1.2.1 # run, tests
2324
- sqlalchemy # run, tests

.tools/envs/testenv-numpy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dependencies:
1818
- joblib # run, tests
1919
- plotly>=6.2 # run, tests
2020
- matplotlib # tests
21+
- bokeh # tests
2122
- pybaum>=0.1.2 # run, tests
2223
- scipy>=1.2.1 # run, tests
2324
- sqlalchemy # run, tests

.tools/envs/testenv-others.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dependencies:
1818
- pandas # run, tests
1919
- plotly>=6.2 # run, tests
2020
- matplotlib # tests
21+
- bokeh # tests
2122
- pybaum>=0.1.2 # run, tests
2223
- scipy>=1.2.1 # run, tests
2324
- sqlalchemy # run, tests

.tools/envs/testenv-pandas.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dependencies:
1818
- joblib # run, tests
1919
- plotly>=6.2 # run, tests
2020
- matplotlib # tests
21+
- bokeh # tests
2122
- pybaum>=0.1.2 # run, tests
2223
- scipy>=1.2.1 # run, tests
2324
- sqlalchemy # run, tests

.tools/envs/testenv-plotly.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dependencies:
1818
- numpy >= 2 # run, tests
1919
- pandas # run, tests
2020
- matplotlib # tests
21+
- bokeh # tests
2122
- pybaum>=0.1.2 # run, tests
2223
- scipy>=1.2.1 # run, tests
2324
- sqlalchemy # run, tests

docs/rtd_environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ dependencies:
1919
- furo
2020
- pybaum
2121
- matplotlib
22+
- bokeh
2223
- seaborn
2324
- numpy
2425
- pandas

docs/source/how_to/how_to_change_plotting_backend.ipynb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@
4444
"\n",
4545
":::\n",
4646
"\n",
47+
":::{tab-item} Bokeh\n",
48+
"\n",
49+
"To select the Bokeh backend, set `backend=\"bokeh\"`.\n",
50+
"\n",
51+
"The returned figure object is a [`bokeh.plotting.figure`](https://docs.bokeh.org/en/latest/docs/reference/plotting/figure.html).\n",
52+
"\n",
53+
"```{note}\n",
54+
"In case of grid plots (such as `convergence_plot` or `slice_plot`), the returned object is a [`bokeh.models.GridPlot`](https://docs.bokeh.org/en/latest/docs/reference/models/plots.html#bokeh.models.GridPlot) object.\n",
55+
"```\n",
56+
"\n",
57+
"```{warning}\n",
58+
"Bokeh applies themes globally. Passing the `template` parameter to a plotting function updates the theme for all existing and future Bokeh plots. If you do not pass `template`, a default template is applied, which will also change the global theme.\n",
59+
"```\n",
4760
"::::"
4861
]
4962
},
@@ -134,6 +147,29 @@
134147
"source": [
135148
"ax = om.criterion_plot(results, backend=\"matplotlib\")"
136149
]
150+
},
151+
{
152+
"cell_type": "markdown",
153+
"id": "10",
154+
"metadata": {},
155+
"source": [
156+
"## Bokeh"
157+
]
158+
},
159+
{
160+
"cell_type": "code",
161+
"execution_count": null,
162+
"id": "11",
163+
"metadata": {},
164+
"outputs": [],
165+
"source": [
166+
"from bokeh.io import output_notebook, show\n",
167+
"\n",
168+
"output_notebook()\n",
169+
"\n",
170+
"p = om.criterion_plot(results, backend=\"bokeh\")\n",
171+
"show(p)"
172+
]
137173
}
138174
],
139175
"metadata": {

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dependencies:
2222
- pandas # run, tests
2323
- plotly>=6.2 # run, tests
2424
- matplotlib # tests
25+
- bokeh # tests
2526
- pybaum>=0.1.2 # run, tests
2627
- scipy>=1.2.1 # run, tests
2728
- sqlalchemy # run, tests

src/optimagic/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def _is_installed(module_name: str) -> bool:
6262
# ======================================================================================
6363

6464
IS_MATPLOTLIB_INSTALLED = _is_installed("matplotlib")
65-
65+
IS_BOKEH_INSTALLED = _is_installed("bokeh")
6666

6767
# ======================================================================================
6868
# Check if pandas version is newer or equal to version 2.1.0

0 commit comments

Comments
 (0)