Skip to content

Commit

Permalink
Improve backend documentation and get plot_forest to follow best prac…
Browse files Browse the repository at this point in the history
…tices (#78)

* start working on best practices and backend docs

* use none backend as documentation base

* add images for plotly and none

* adapt minigallery directive

* use none backend instead of arviz_plots.backend

* gallery references and plot sizing improvements

* fix typo

* pylint

* wait until using sphinx 8

* pseudo fix for empty minigallery

* modify slightly auto sizing

* Apply suggestions from code review

Co-authored-by: Osvaldo A Martin <[email protected]>

* add see also

---------

Co-authored-by: Osvaldo A Martin <[email protected]>
  • Loading branch information
OriolAbril and aloctavodia authored Aug 6, 2024
1 parent 60aac9a commit 32a8702
Show file tree
Hide file tree
Showing 35 changed files with 353 additions and 479 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ docs/source/api/**/generated
docs/source/gallery/_images
docs/source/gallery/_scripts
docs/source/gallery/*.md
docs/source/gallery/backreferences.json
docs/jupyter_execute
docs/source/api/backend/matplotlib.rst
docs/source/api/backend/bokeh.rst
docs/source/api/backend/index.rst
docs/source/api/backend/*.rst
!docs/source/api/backend/*.part.rst
!docs/source/api/backend/index.rst

# PyBuilder
.pybuilder/
Expand Down
1 change: 1 addition & 0 deletions docs/source/_static/no-image.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/plotly-logo-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/plotly-logo-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Interface to plotting backends
Available backends
------------------

.. grid:: 2
.. grid:: 1 1 2 2

.. grid-item-card::
:link: matplotlib
Expand All @@ -22,12 +22,44 @@ Available backends
:img-background: ../../_static/bokeh-logo-light.svg
:class-img-bottom: dark-light

.. grid-item-card::
:link: plotly
:link-type: doc
:link-alt: plotly
:img-background: ../../_static/plotly-logo-light.png
:class-img-bottom: dark-light

.. grid-item-card::
:link: none
:link-type: doc
:link-alt: none

.. grid:: 3

.. grid-item::

.. image:: ../../_static/no-image.svg
:class: dark-light
:alt:

.. grid-item::

Data

.. grid-item::

.. raw:: html

<s>Viz</s>

.. toctree::
:maxdepth: 1
:hidden:

Matplotlib <matplotlib>
Bokeh <bokeh>
Plotly <plotly>
None (only processing, no plotting) <none>

---------------------------
Common interface definition
Expand Down Expand Up @@ -85,5 +117,3 @@ Common interface definition

axis
Data axis (x, y or both) on which to apply the function.

.. autosummary of module elements will be added here from template
5 changes: 5 additions & 0 deletions docs/source/api/backend/none.part.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
============
None backend
============

.. automodule:: arviz_plots.backend.none
5 changes: 5 additions & 0 deletions docs/source/api/backend/plotly.part.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
==============
Plotly backend
==============

.. automodule:: arviz_plots.backend.plotly
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
]
suppress_warnings = ["mystnb.unknown_mime_type"]

backend_modules = ("index", "matplotlib", "bokeh")
backend_modules = ("none", "matplotlib", "bokeh", "plotly")
api_backend_dir = Path(__file__).parent.resolve() / "api" / "backend"
with open(api_backend_dir / "interface.template.rst", "r", encoding="utf-8") as f:
interface_template = f.read()
Expand Down
3 changes: 0 additions & 3 deletions docs/source/gallery/distribution/plot_dist_ecdf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
(gallery_dist_ecdf)=
# ECDF plot
Facetted ECDF plots for 1D marginals of the distribution
Expand All @@ -8,8 +7,6 @@
:::{seealso}
API Documentation: {func}`~arviz_plots.plot_dist`
Other gallery examples using `plot_dist`: {ref}`gallery_dist_kde`
:::
"""
from arviz_base import load_arviz_data
Expand Down
3 changes: 0 additions & 3 deletions docs/source/gallery/distribution/plot_dist_kde.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
(gallery_dist_kde)=
# KDE plot
Facetted KDE plots for 1D marginals of the distribution
Expand All @@ -8,8 +7,6 @@
:::{seealso}
API Documentation: {func}`~arviz_plots.plot_dist`
Other gallery examples using `plot_dist`: {ref}`gallery_dist_ecdf`
:::
"""
from arviz_base import load_arviz_data
Expand Down
3 changes: 0 additions & 3 deletions docs/source/gallery/distribution/plot_forest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
(gallery_forest)=
# Forest plot
Default forest plot with marginal distribution summaries
Expand All @@ -8,8 +7,6 @@
:::{seealso}
API Documentation: {func}`~arviz_plots.plot_forest`
Other gallery examples using `plot_forest`: {ref}`gallery_forest_shade`
:::
"""
from arviz_base import load_arviz_data
Expand Down
3 changes: 0 additions & 3 deletions docs/source/gallery/distribution/plot_forest_shade.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
(gallery_forest_shade)=
# Forest plot with shading
Forest plot marginal summaries with row shading to enhance reading
Expand All @@ -8,8 +7,6 @@
:::{seealso}
API Documentation: {func}`~arviz_plots.plot_forest`
Other gallery examples using `plot_forest`: {ref}`gallery_forest`
:::
"""
from arviz_base import load_arviz_data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
(gallery_dist_models)=
# Marginal distribution comparison plot
Full marginal distribution comparison between different models
Expand All @@ -9,8 +8,6 @@
:::{seealso}
API Documentation: {func}`~arviz_plots.plot_dist`
Other gallery examples using `plot_dist`: {ref}`gallery_dist_kde`, {ref}`gallery_dist_ecdf`
Other examples comparing marginal distributions: {ref}`gallery_forest_models`
:::
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
(gallery_forest_models)=
# Forest plot comparison
Forest plot summaries for 1D marginal distributions
Expand All @@ -9,8 +8,6 @@
:::{seealso}
API Documentation: {func}`~arviz_plots.plot_forest`
Other gallery examples using `plot_forest`: {ref}`gallery_forest`, {ref}`gallery_forest_shade`
Other examples comparing marginal distributions: {ref}`gallery_dist_models`
:::
"""
Expand Down
1 change: 0 additions & 1 deletion docs/source/gallery/inference_diagnostics/plot_trace.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
(gallery_trace)=
# Trace plot
Facetted plot with MCMC traces for each variable
Expand Down
3 changes: 0 additions & 3 deletions docs/source/gallery/mixed/plot_forest_ess.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
(gallery_forest_ess)=
# Forest plot with ESS
Multiple panel visualization with a forest plot and ESS information
Expand All @@ -8,8 +7,6 @@
:::{seealso}
API Documentation: {func}`~arviz_plots.plot_forest`
Other gallery examples using `plot_forest`: {ref}`gallery_forest`, {ref}`gallery_forest_shade`
:::
"""
from importlib import import_module
Expand Down
1 change: 0 additions & 1 deletion docs/source/gallery/mixed/plot_trace_dist.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
(gallery_trace_dist)=
# Trace and distribution plot
Two column layout with marginal distributions on the left and MCMC traces on the right
Expand Down
3 changes: 0 additions & 3 deletions docs/source/gallery/model_criticism/plot_forest_pp_obs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
(gallery_forest_pp_obs)=
# Posterior predictive and observations forest plot
Overlay of forest plot for the posterior predictive samples and the actual observations
Expand All @@ -8,8 +7,6 @@
:::{seealso}
API Documentation: {func}`~arviz_plots.plot_forest`
Other gallery examples using `plot_forest`: {ref}`gallery_forest`, {ref}`gallery_forest_shade`
:::
"""
from importlib import import_module
Expand Down
Loading

0 comments on commit 32a8702

Please sign in to comment.