Skip to content

Fix rug rendering for Bokeh and Plotly backends - #542

Open
Kkkakania wants to merge 1 commit into
arviz-devs:mainfrom
Kkkakania:agent/fix-rug-backends
Open

Fix rug rendering for Bokeh and Plotly backends#542
Kkkakania wants to merge 1 commit into
arviz-devs:mainfrom
Kkkakania:agent/fix-rug-backends

Conversation

@Kkkakania

@Kkkakania Kkkakania commented Jul 24, 2026

Copy link
Copy Markdown

Summary

  • flatten multi-dimensional sample data before constructing rug coordinates
  • convert Matplotlib-style marker area to Bokeh marker diameter for every marker
  • keep the vertical rug marker mapping limited to Bokeh marker and angle semantics
  • add backend-specific and end-to-end regression tests

Fixes #535.

Verification

  • uv run --extra test --extra matplotlib --extra bokeh --extra plotly pytest tests/test_bokeh.py tests/test_plotly.py tests/test_plots.py -q (636 passed, 3 skipped)
  • uvx ruff check src/arviz_plots/backend/bokeh/core.py src/arviz_plots/backend/plotly/core.py src/arviz_plots/visuals/__init__.py tests/test_bokeh.py tests/test_plotly.py tests/test_plots.py
  • uvx ruff format --check src/arviz_plots/backend/bokeh/core.py src/arviz_plots/backend/plotly/core.py src/arviz_plots/visuals/__init__.py tests/test_bokeh.py tests/test_plotly.py tests/test_plots.py

AI assistance

I used Codex to help inspect the backend-specific marker semantics and draft the tests. I reviewed the implementation, verified the behavior across the Bokeh, Plotly, and backend-neutral paths, and can maintain the submitted changes.

@Kkkakania

Copy link
Copy Markdown
Author

I investigated the failed Read the Docs check. The build completes installation and reaches the gallery, then fails in the existing plot_dgof example with ValueError: cannot rename 'pit_dim' because it is not a variable or dimension in this dataset from plot_ecdf_pit.

This is unrelated to the rug-rendering files changed here. The same traceback is present in all three recent RTD builds for PR #540 (builds 33674049, 33674946, and 33675021), which confirms it is a shared docs/dependency failure rather than a regression from this PR. The focused test suite and backend tests listed in the description remain green locally.

@OriolAbril OriolAbril left a comment

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.

Thanks for the PR and the note on LLM use and especially for checking things work and do what is expected. If I may even though I don't know what your goals are I would recommend focusing on understanding what the code is doing. I think doing that would probably have gotten you even further in the PR and also been more helpful for any related future task.

For example, you might have fixed the comments on the bokeh and plotly backends directly. We single "|" marker out to help with generating rug plots, but after that bokeh sees marker="dash", why would this marker behave differently than the rest? Similarly, plotly is one of the most popular plotting libraries in python, why would the default behaviour of scatter(data, symbol="line-ns-open") be plotting something that can't be seen?


The readthedocs failure was due to a temporal mismatch between arviz-stats and arviz-plots, once you rebase on main it will be fixed.

Comment thread src/arviz_plots/backend/bokeh/core.py Outdated
Comment thread src/arviz_plots/backend/bokeh/core.py Outdated
Comment thread src/arviz_plots/backend/plotly/core.py Outdated
Comment thread tests/test_bokeh.py Outdated
@Kkkakania
Kkkakania force-pushed the agent/fix-rug-backends branch from 4950bca to 09dde35 Compare August 1, 2026 11:16
@Kkkakania

Copy link
Copy Markdown
Author

Rebased onto current main and revised the backend changes in 09dde35. The Plotly line-width override is gone; Bokeh now converts area-style size values for every marker, while the | branch only handles marker mapping and rotation. The Bokeh tests now cover basic data, generic kwargs, and vertical-marker semantics.

Verification after the rebase: 636 passed, 3 skipped across tests/test_bokeh.py, tests/test_plotly.py, and tests/test_plots.py; Ruff check and format check also pass.

@read-the-docs-community

Copy link
Copy Markdown

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.63%. Comparing base (ec19a33) to head (09dde35).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #542   +/-   ##
=======================================
  Coverage   88.63%   88.63%           
=======================================
  Files          64       64           
  Lines        7266     7268    +2     
=======================================
+ Hits         6440     6442    +2     
  Misses        826      826           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Rug not properly displayed for plotly and bokeh backends

3 participants