Skip to content

hvPlotAgent cannot express any color options, so hvPlot's colormap defaults are unreachable #1931

Description

@ghostiee-11

hvPlotAgent builds its response model from the declared params of hvPlotUIView via param_to_pydantic (lumen/ai/agents/hvplot.py:51). hvPlotBaseView declares only kind, x, y, by, groupby and geo (lumen/views/base.py:925-970), so the generated model has no color field at all. The agent cannot pick a colormap even when the user explicitly asks for one.

That matters more than it first looks, because hvPlot already does a lot here on its own:

  • _default_cmaps (hvplot/converter.py:840-845) maps linear to kbc_r, diverging to coolwarm, categorical to glasbey_category10 and cyclic to colorwheel
  • _process_symmetric (hvplot/converter.py:1302-1332) auto-detects diverging data from the 5th/95th percentiles and then selects the diverging colormap (converter.py:1227-1233)
  • the strings linear, diverging, categorical and cyclic are accepted as semantic cmap aliases (hvplot/converter.py:1838-1839)

None of that is reachable from Lumen today.

The one color-adjacent value Lumen does inject is cnorm="log" for large datasets (lumen/ai/agents/hvplot.py:72-74), which sets a log color norm without any colormap alongside it.

Declaring cmap plus a few related options would let the agent use the semantic aliases, which seems like a better fit for an LLM than asking it to pick from the full colormap list.

One thing worth being careful about if anyone picks this up: symmetric, colorbar, cnorm, robust and rescale_discrete_levels are all None-defaulted in hvPlot's converter so it can distinguish "unset" from "explicitly False", and each is forwarded only under if x is not None. Declaring symmetric as param.Boolean(default=False) would silently disable the auto-detection above, so these want default=None with allow_None=True.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions