Skip to content

Improve docstrings for visual interfaces and fix hline function #450

Open
aatifjunaid wants to merge 2 commits intoarviz-devs:mainfrom
aatifjunaid:aatif-branch
Open

Improve docstrings for visual interfaces and fix hline function #450
aatifjunaid wants to merge 2 commits intoarviz-devs:mainfrom
aatifjunaid:aatif-branch

Conversation

@aatifjunaid
Copy link
Copy Markdown

  • Improved and standardized docstrings for visual interface functions.
  • Fixed incorrect "function": "vline" reference in hline.

@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 arviz-plots | 🛠️ Build #31649708 | 📁 Comparing 2389a4e against latest (76d2b61)


🔍 Preview build

Show files changed (80 files in total): 📝 80 modified | ➕ 0 added | ➖ 0 deleted
File Status
gallery/add_reference_bands.html 📝 modified
gallery/add_reference_lines.html 📝 modified
gallery/combine_plots.html 📝 modified
gallery/plot_autocorr.html 📝 modified
gallery/plot_bf.html 📝 modified
gallery/plot_compare.html 📝 modified
gallery/plot_convergence_dist.html 📝 modified
gallery/plot_dgof.html 📝 modified
gallery/plot_dgof_dist.html 📝 modified
gallery/plot_dist_ecdf.html 📝 modified
gallery/plot_dist_hist.html 📝 modified
gallery/plot_dist_kde.html 📝 modified
gallery/plot_dist_models.html 📝 modified
gallery/plot_dist_qds.html 📝 modified
gallery/plot_ecdf_coverage.html 📝 modified
gallery/plot_ecdf_pit.html 📝 modified
gallery/plot_energy.html 📝 modified
gallery/plot_ess_evolution.html 📝 modified
gallery/plot_ess_local.html 📝 modified
gallery/plot_ess_models.html 📝 modified
gallery/plot_ess_quantile.html 📝 modified
gallery/plot_forest.html 📝 modified
gallery/plot_forest_ess.html 📝 modified
gallery/plot_forest_models.html 📝 modified
gallery/plot_forest_pp_obs.html 📝 modified
gallery/plot_forest_shade.html 📝 modified
gallery/plot_khat.html 📝 modified
gallery/plot_khat_aesthetics.html 📝 modified
gallery/plot_khat_facet_cols.html 📝 modified
gallery/plot_khat_facet_grid.html 📝 modified
gallery/plot_lm.html 📝 modified
gallery/plot_loo_pit.html 📝 modified
gallery/plot_mcse.html 📝 modified
gallery/plot_pair.html 📝 modified
gallery/plot_pair_distribution.html 📝 modified
gallery/plot_pair_focus.html 📝 modified
gallery/plot_pair_focus_distribution.html 📝 modified
gallery/plot_parallel.html 📝 modified
gallery/plot_pava_calibration.html 📝 modified
gallery/plot_ppc_censored.html 📝 modified
gallery/plot_ppc_coverage.html 📝 modified
gallery/plot_ppc_dist.html 📝 modified
gallery/plot_ppc_interval.html 📝 modified
gallery/plot_ppc_pava_residuals.html 📝 modified
gallery/plot_ppc_pit.html 📝 modified
gallery/plot_ppc_rootogram.html 📝 modified
gallery/plot_ppc_tstat.html 📝 modified
gallery/plot_prior_posterior.html 📝 modified
gallery/plot_psense.html 📝 modified
gallery/plot_psense_quantities.html 📝 modified
gallery/plot_rank.html 📝 modified
gallery/plot_rank_dist.html 📝 modified
gallery/plot_ridge.html 📝 modified
gallery/plot_ridge_multiple.html 📝 modified
gallery/plot_trace.html 📝 modified
gallery/plot_trace_dist.html 📝 modified
api/backend/index.html 📝 modified
api/generated/arviz_plots.PlotCollection.generate_aes_dt.html 📝 modified
api/backend/generated/arviz_plots.backend.ciliney.html 📝 modified
api/backend/generated/arviz_plots.backend.fill_between_y.html 📝 modified
api/backend/generated/arviz_plots.backend.grid.html 📝 modified
api/backend/generated/arviz_plots.backend.hist.html 📝 modified
api/backend/generated/arviz_plots.backend.hline.html 📝 modified
api/backend/generated/arviz_plots.backend.hspan.html 📝 modified
api/backend/generated/arviz_plots.backend.multiple_lines.html 📝 modified
api/backend/generated/arviz_plots.backend.remove_axis.html 📝 modified
api/backend/generated/arviz_plots.backend.remove_ticks.html 📝 modified
api/backend/generated/arviz_plots.backend.set_ticklabel_visibility.html 📝 modified
api/backend/generated/arviz_plots.backend.set_y_scale.html 📝 modified
api/backend/generated/arviz_plots.backend.step.html 📝 modified
api/backend/generated/arviz_plots.backend.text.html 📝 modified
api/backend/generated/arviz_plots.backend.ticklabel_props.html 📝 modified
api/backend/generated/arviz_plots.backend.title.html 📝 modified
api/backend/generated/arviz_plots.backend.vline.html 📝 modified
api/backend/generated/arviz_plots.backend.vspan.html 📝 modified
api/backend/generated/arviz_plots.backend.xlabel.html 📝 modified
api/backend/generated/arviz_plots.backend.xticks.html 📝 modified
api/backend/generated/arviz_plots.backend.ylabel.html 📝 modified
api/backend/generated/arviz_plots.backend.yticks.html 📝 modified
_modules/arviz_plots/backend/none/core.html 📝 modified

Copy link
Copy Markdown
Member

@OriolAbril OriolAbril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good thanks. I still have to go over all the docstrings to double check what they say is correct, so some small tweaks might be needed still later on. But before that after a quick skim, the main lacking thing is in **artist_kws. They should always indicate to what backend function things are forwarded too.

@aatifjunaid
Copy link
Copy Markdown
Author

Is it better now?

Copy link
Copy Markdown
Member

@OriolAbril OriolAbril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have stopped at text. I have no idea how you came up with the references for artist_kws and where they are forwarded too but please review them. The backend functions are very short so in the majority of cases it is straightforward to see what backend method/function gets called.


* matplotlib -> :meth:`~matplotlib.figure.Figure.suptitle`
* plotly -> :meth:`~plotly.graph_objects.Figure.update_layout` (``title=...``)
* bokeh -> :attr:`~bokeh.plotting.figure.Figure.title`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the bokeh reference is incorrect. The function does something completely different, and whatever is linked here can never be an attribute, it is something callable because we forward keyword arguments to it when calling it.

target : PlotObject
The backend object representing a :term:`plot` where this :term:`visual`
should be added.
bottom : float, default 0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless it is something that can't be an integer we try to use scalar instead.

Also, in this particular case I am quite sure arrays are also valid so I'd update it to:

Suggested change
bottom : float, default 0
bottom : scalar or ndarray, default 0

Comment on lines +425 to +427
* matplotlib -> :meth:`~matplotlib.axes.Axes.plot`
* plotly -> :class:`~plotly.graph_objects.Scatter` with (``mode="lines"``)
* bokeh -> :meth:`~bokeh.plotting.figure.line`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both matplotlib and bokeh references are wrong here

Comment on lines +536 to +538
step_mode : any, optional
Defines how the step transitions are drawn (e.g. ``pre``, ``post``, ``mid``).
Interpretation depends on the plotting backend.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is not any, it should be string, in fact one of 3 possible strings only. Therefore:

Suggested change
step_mode : any, optional
Defines how the step transitions are drawn (e.g. ``pre``, ``post``, ``mid``).
Interpretation depends on the plotting backend.
step_mode : {"before", "center", "after"}, optional
Defines how the step transitions are drawn.

Passed to the backend plotting function of the respective backend:

* matplotlib -> :meth:`~matplotlib.axes.Axes.step`
* plotly -> :class:`~plotly.graph_objects.Scatter` (``line_shape="hv"`` or similar)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* plotly -> :class:`~plotly.graph_objects.Scatter` (``line_shape="hv"`` or similar)
* plotly -> :class:`~plotly.graph_objects.Scatter` with (``mode="lines"``)


Parameters
----------
x, y : float or array-like
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here I am quite sure only scalars are valid and arrays or array-like objects would error out. If you can please test it, otherwise let me know and I'll double check when I get some time. In any case, if x and y can be arrays, then string should also be one

Comment on lines +597 to +599
vertical_align, horizontal_align : any, optional
Alignment properties of the text.
Interpretation depends on the plotting backend.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neither of the two is backend dependent, vertical_align can be top, middle or bottom. And horizontal_align can be left, center, right.

Comment on lines +604 to +605
* plotly -> :class:`~plotly.graph_objects.layout.Annotation`
* bokeh -> :class:`~bokeh.models.annotations.Label`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bokeh and plotly references are wrong.

@aatifjunaid
Copy link
Copy Markdown
Author

Hi, sorry for the late response — I got caught up with deadlines.

Thanks a lot for the detailed feedback. I’ll go through each of your comments carefully, verify them against the backend implementations, and update the PR accordingly.

Really appreciate your patience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants