From 9b1eb1f4f94cdf5db3624b150eb2039654db251c Mon Sep 17 00:00:00 2001 From: Jason Kai Date: Fri, 20 Oct 2023 09:26:52 -0400 Subject: [PATCH] Fix plotting documentation Issue with matplotlib installation that prevented the plotting page to be loaded. This was due to a `poetry` installation command. Also added intersphinx mappings for plotting functionality and made some text changes to docstrings. --- .gitignore | 3 ++- .readthedocs.yml | 4 +++- afids_utils/metrics.py | 2 +- afids_utils/plotting.py | 7 +++---- docs/api/transform.md | 2 +- docs/conf.py | 4 ++++ 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 53ed9238..c12c944b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ # Directories __pycache__/ +_build/ # Testing .hypothesis .ruff_cache -.pytest_cache \ No newline at end of file +.pytest_cache diff --git a/.readthedocs.yml b/.readthedocs.yml index 8fa269db..821e1af7 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -17,9 +17,11 @@ formats: [pdf] build: os: ubuntu-20.04 tools: - python: '3.10' + python: "3.10" python: install: - requirements: docs/requirements.txt - method: pip path: . + extra_requirements: + - plotting diff --git a/afids_utils/metrics.py b/afids_utils/metrics.py index f7977e82..ce7e4289 100644 --- a/afids_utils/metrics.py +++ b/afids_utils/metrics.py @@ -65,7 +65,7 @@ def mean_distances( template_afid_set: AfidSet, component: str = "distance", ) -> list[float]: - """Calculate the average distance for a given spatial component betweeen + """Calculate the average distance for a given spatial component between a collection of ``AfidSet`` objects and a common / template ``AfidSet``. Parameters diff --git a/afids_utils/plotting.py b/afids_utils/plotting.py index 4dc77b61..2d8c626a 100644 --- a/afids_utils/plotting.py +++ b/afids_utils/plotting.py @@ -87,11 +87,11 @@ def plot_ortho( nii_img: nib.nifti1.Nifti1Image, opacity: float = 1, ) -> StatMapView: - """Generate interactive, html ortho view of the slices. Uses ``nilearn`` - to generate the figures. + """Generate interactive, html ortho view of the slices. Uses + ``nilearn.plotting`` to generate the figures. The generated view can either be opened interactively or saved as a figure - per ``nilearn`` functionality: + per ``nilearn.plotting`` functionality: * Interactive view - ``view.open_in_browser()`` * Save - ``view.save_as_html(file_name.html)`` @@ -108,7 +108,6 @@ def plot_ortho( opacity: Opacity value [0 - transparent, 1 - opaque] of overlaid AFIDs - (default: 0.8) Returns ------- diff --git a/docs/api/transform.md b/docs/api/transform.md index b7f280db..e2901992 100644 --- a/docs/api/transform.md +++ b/docs/api/transform.md @@ -3,4 +3,4 @@ ```{eval-rst} .. automodule:: afids_utils.transforms :members: -``` \ No newline at end of file +``` diff --git a/docs/conf.py b/docs/conf.py index 1a5b573b..0bef26bf 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -80,7 +80,11 @@ intersphinx_mapping = { "python": ("https://docs.python.org/3", None), + "matplotlib": ("https://matplotlib.org/stable", None), + "nibabel": ("https://nipy.org/nibabel", None), + "nilearn": ("https://nilearn.github.io/stable/plotting", None), "numpy": ("https://numpy.org/doc/1.24", None), + "plotly": ("https://plotly.com/python", None), }