Skip to content

Fix autoplot: register hvplot xarray accessor and handle single-element plots#110

Merged
marcosfrenkel merged 1 commit intotoolsforexperiments:mainfrom
marcosfrenkel:fixing_autoplot
May 8, 2026
Merged

Fix autoplot: register hvplot xarray accessor and handle single-element plots#110
marcosfrenkel merged 1 commit intotoolsforexperiments:mainfrom
marcosfrenkel:fixing_autoplot

Conversation

@marcosfrenkel
Copy link
Copy Markdown
Contributor

@marcosfrenkel marcosfrenkel commented May 8, 2026

Summary

  • Add import hvplot.xarray to hvplotting.py so the .hvplot accessor is registered on xarray objects (was causing AttributeError: 'DataArray' object has no attribute 'hvplot' on load)
  • Fix plot_xr_as_2d to return the plot directly when .cols() is not available (single QuadMesh element has no .cols(), only multi-plot Layout objects do)
  • Guard .cols(2) call in plot_panel the same way

Root causes

hvplot requires an explicit submodule import (hvplot.xarray, hvplot.pandas) to register its accessors — import hvplot alone does not do it. Additionally, .cols() is a method on HoloViews Layout objects (produced by +-combining plots), not on individual elements like QuadMesh.

@marcosfrenkel marcosfrenkel changed the title Fix plot handling in hvplotting.py to prevent AttributeError and regi… Fix autoplot: register hvplot xarray accessor and handle single-element plots May 8, 2026
@marcosfrenkel marcosfrenkel merged commit d7f4d60 into toolsforexperiments:main May 8, 2026
7 checks passed
@marcosfrenkel marcosfrenkel deleted the fixing_autoplot branch May 8, 2026 20:42
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.

1 participant