Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .tools/envs/testenv-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies:
- plotly>=6.2 # run, tests
- matplotlib # tests
- bokeh # tests
- altair # tests
- pybaum>=0.1.2 # run, tests
- scipy>=1.2.1 # run, tests
- sqlalchemy # run, tests
Expand Down
1 change: 1 addition & 0 deletions .tools/envs/testenv-nevergrad.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies:
- plotly>=6.2 # run, tests
- matplotlib # tests
- bokeh # tests
- altair # tests
- pybaum>=0.1.2 # run, tests
- scipy>=1.2.1 # run, tests
- sqlalchemy # run, tests
Expand Down
1 change: 1 addition & 0 deletions .tools/envs/testenv-numpy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies:
- plotly>=6.2 # run, tests
- matplotlib # tests
- bokeh # tests
- altair # tests
- pybaum>=0.1.2 # run, tests
- scipy>=1.2.1 # run, tests
- sqlalchemy # run, tests
Expand Down
1 change: 1 addition & 0 deletions .tools/envs/testenv-others.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies:
- plotly>=6.2 # run, tests
- matplotlib # tests
- bokeh # tests
- altair # tests
- pybaum>=0.1.2 # run, tests
- scipy>=1.2.1 # run, tests
- sqlalchemy # run, tests
Expand Down
1 change: 1 addition & 0 deletions .tools/envs/testenv-pandas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies:
- plotly>=6.2 # run, tests
- matplotlib # tests
- bokeh # tests
- altair # tests
- pybaum>=0.1.2 # run, tests
- scipy>=1.2.1 # run, tests
- sqlalchemy # run, tests
Expand Down
1 change: 1 addition & 0 deletions .tools/envs/testenv-plotly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies:
- pandas # run, tests
- matplotlib # tests
- bokeh # tests
- altair # tests
- pybaum>=0.1.2 # run, tests
- scipy>=1.2.1 # run, tests
- sqlalchemy # run, tests
Expand Down
2 changes: 2 additions & 0 deletions docs/rtd_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ dependencies:
- pybaum
- matplotlib
- bokeh
- altair
- anywidget
- seaborn
- numpy
- pandas
Expand Down
58 changes: 56 additions & 2 deletions docs/source/how_to/how_to_change_plotting_backend.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@
"```{warning}\n",
"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",
"```\n",
"\n",
":::\n",
"\n",
":::{tab-item} Altair\n",
"To select the Altair backend, set `backend=\"altair\"`.\n",
"\n",
"The returned figure object is an [`altair.Chart`](https://altair-viz.github.io/user_guide/generated/toplevel/altair.Chart.html).\n",
"\n",
"```{note}\n",
"In case of grid plots (such as `convergence_plot` or `slice_plot`), the returned object is either an [`altair.Chart`](https://altair-viz.github.io/user_guide/generated/toplevel/altair.Chart.html) if there is only one subplot, an [`altair.HConcatChart`](https://altair-viz.github.io/user_guide/generated/toplevel/altair.HConcatChart.html) if there is only one row, or an [`altair.VConcatChart`](https://altair-viz.github.io/user_guide/generated/toplevel/altair.VConcatChart.html) otherwise.\n",
"```\n",
"\n",
":::\n",
"\n",
"::::"
]
},
Expand Down Expand Up @@ -170,11 +184,51 @@
"p = om.criterion_plot(results, backend=\"bokeh\")\n",
"show(p)"
]
},
{
"cell_type": "markdown",
"id": "12",
"metadata": {},
"source": [
"## Altair"
]
},
{
"cell_type": "markdown",
"id": "13",
"metadata": {},
"source": [
":::{note}\n",
"\n",
"It is mostly not required to set the renderer manually, as Altair automatically\n",
"selects the appropriate renderer based on your environment. In this example,\n",
"we explicitly set the renderer to ensure correct display within the documentation.\n",
"\n",
"Refer to the [Altair documentation](https://altair-viz.github.io/user_guide/display_frontends.html) for more details.\n",
"\n",
":::"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "14",
"metadata": {},
"outputs": [],
"source": [
"import altair as alt\n",
"\n",
"# Setting the renderer is mostly not required. See note above.\n",
"alt.renderers.enable(\"jupyter\")\n",
"\n",
"chart = om.criterion_plot(results, backend=\"altair\")\n",
"chart.show()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "optimagic",
"language": "python",
"name": "python3"
},
Expand All @@ -188,7 +242,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.18"
"version": "3.10.17"
}
},
"nbformat": 4,
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies:
- plotly>=6.2 # run, tests
- matplotlib # tests
- bokeh # tests
- altair # tests
- pybaum>=0.1.2 # run, tests
- scipy>=1.2.1 # run, tests
- sqlalchemy # run, tests
Expand Down
1 change: 1 addition & 0 deletions src/optimagic/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def _is_installed(module_name: str) -> bool:

IS_MATPLOTLIB_INSTALLED = _is_installed("matplotlib")
IS_BOKEH_INSTALLED = _is_installed("bokeh")
IS_ALTAIR_INSTALLED = _is_installed("altair")

# ======================================================================================
# Check if pandas version is newer or equal to version 2.1.0
Expand Down
Loading
Loading