Skip to content

Conversation

@Azaya89
Copy link
Collaborator

@Azaya89 Azaya89 commented Nov 6, 2025

fixes #391

This PR:

  • Fixes hover tooltips showing confusing internal _color and _size fields when passing mapped Series to color/size parameters. The fix automatically excludes these internal columns from default hover tooltips while respecting explicit hover_tooltips configurations.

  • Documentation updated to recommend using color='column' + cmap={...} for custom color mapping.

  • Added tests

Examples

  1. From Issue Specifying color adds _color entry hover-over #391
import hvplot.pandas

penguins = hvplot.sampledata.penguins('pandas')
penguins.hvplot.scatter(
    x="bill_length_mm",
    y="bill_depth_mm",
    color=penguins["species"].map({
        "Adelie":"blue",
        "Gentoo":"yellow",
        "Chinstrap":"red",
    }),
)
Screenshot 2025-11-06 at 3 40 48 PM
  1. Recommended approach
import hvplot.pandas

penguins = hvplot.sampledata.penguins('pandas')
penguins.hvplot.scatter(
    x="bill_length_mm",
    y="bill_depth_mm",
    color='species',
    cmap={
        "Adelie":"blue",
        "Gentoo":"yellow",
        "Chinstrap":"red",
    },
)
Screenshot 2025-11-06 at 3 42 34 PM

@Azaya89 Azaya89 requested a review from maximlt November 6, 2025 15:15
Copy link
Member

@maximlt maximlt left a comment

Choose a reason for hiding this comment

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

Thanks!!!

expected = altered_df.hvplot.scatter('x', 'y', c='_color')
self.assertEqual(actual, expected)

def test_color_series_excluded_from_default_hover(self):
Copy link
Member

Choose a reason for hiding this comment

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

Moved the tests to Charts1D, next to the other _color test (see above). In addition, having scatter plots in Charts1D wasn't appropriate, as this is a 1D chart (2D are points, paths, etc.).

plot, element(self.cat_df.reset_index(), ['x', 'y'], ['index', 'category'])
)

# Skip Series.map() tests as they don't work with Dask
Copy link
Member

Choose a reason for hiding this comment

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

I've re-enabled the dask tests. This showed that hvPlot doesn't support color=<lazy_dask_series_thing>. The comments didn't make it very clear to me what the root cause was for skipping them.

@maximlt maximlt merged commit 60b091c into main Nov 17, 2025
14 checks passed
@maximlt maximlt deleted the fix-391 branch November 17, 2025 15:00
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.

Specifying color adds _color entry hover-over

3 participants