Skip to content

Conversation

@ahuang11
Copy link
Collaborator

@ahuang11 ahuang11 commented Sep 26, 2023

Closes #1153

import hvplot.pandas

from bokeh.sampledata.penguins import data as df

df.hvplot.explorer(title="ABCD", kind="scatter", x="flipper_length_mm", y="body_mass_g", by=["species"])
image

@ahuang11 ahuang11 added this to the 0.9.0 milestone Sep 27, 2023
@maximlt maximlt self-requested a review October 2, 2023 08:21
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.

hvPlot's main entry points are so far:

  • df.hvplot.<ptype>()
  • df.interactive()
  • hvplot.explorer(df)

The first two approaches are patching the data structures that support their operations, dynamically adding the hvplot and interactive accessors. For some reason, this wasn't done with explorer in the first place. Maybe because the explorer is quite different in nature compared to the other two accessors, being basically a not-so-small app. There's also the possibility (not sure it works!) that you can create an explorer from some dataset and update it with another dataset, maybe from a different datatype entirely. That's actually a valid use case for the explorer, imagine a Lumen app filtering/transforming some data that ends up in a pre-defined explorer for more exploration. The more common use case though for the explorer is to operate on a single dataset. In that case, the API offered is inconsistent with the two other entry points and and this is what this PR aims to improve.

One could suggest that hvPlot could add an explorer accessor as it does with hvplot and interactive. I thought about that a little but prefer the approach of this PR, adding a new explorer method under df.hvplot, as the explorer is very close to the plotting API (a lot more than .interactive) and GeoPandas has recently added an .explore method (to get an interactive plot), which could be a little confusing for their users.

@ahuang11 there needs to be a few more docs update:

  • landing page
  • explorer getting started

And I have left a few comments.

"""
return self(x, y, text=text, kind="labels", **kwds)

def explorer(self, x=None, y=None, **kwds):
Copy link
Member

Choose a reason for hiding this comment

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

Also now the explorer has Xarray support I believe this can be moved to hvPlotBase

Copy link
Member

Choose a reason for hiding this comment

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

Amending myself, it's not yet supported as #1141 hasn't been merged, but will be soon I guess so this PR could be adapted accordingly if not merged before.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay I suppose we can wait until that's done first.

@maximlt
Copy link
Member

maximlt commented Oct 12, 2023

I have made these changes:

  • moved the explorer method to hvPlotBase
  • replaced explorer handling in converter.py by handling in hvPlotBase.__call__; I prefer not to have any explorer code in the HoloViewsConverter, it's complicated enough :D

@maximlt maximlt merged commit 39388b8 into main Oct 12, 2023
@maximlt maximlt deleted the explorer_method branch October 12, 2023 14:47
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.

Using hvplot.explorer as method instead of a function?

3 participants