Getting Started with the Explorer#

The hvPlot Explorer is a graphical user interface that allows you to quickly create customized plots through an interactive interface. Instead of writing code repeatedly to adjust plot parameters, you can use the Explorer to visually configure your plots and then export the code when you’re satisfied with the result. The Explorer shines when you need to iteratively explore your data to discover patterns and create meaningful visualizations.

Note

The Explorer requires a live Python kernel to be fully interactive. The widgets shown in this documentation are not interactive when viewed on the website.

What you’ll see#

By the end of this tutorial, you’ll discover how to:

  • Launch the Explorer for different data types

  • Navigate the Explorer interface

  • Create basic plots using the interface

  • Use the Explorer to investigate data relationships

  • Iterate through different visualization approaches

  • Leverage grouping and faceting for deeper insights

  • Work with geographic data

  • Manage and record your exploration sessions

Setup#

First, let’s import hvplot and load some sample data:

import hvplot.pandas  # noqa: this automatically loads the bokeh extension
import hvplot.xarray  # noqa: for xarray support

Launching the Explorer#

The Explorer can be launched in two ways:

  1. Via the top-level function: hvplot.explorer(data)

  2. Via the data accessor method: data.hvplot.explorer()

Let’s start with a simple dataset - the penguins data:

df = hvplot.sampledata.penguins("pandas").dropna()
df.head(3)
species island bill_length_mm bill_depth_mm flipper_length_mm body_mass_g sex year
0 Adelie Torgersen 39.1 18.7 181.0 3750.0 male 2007
1 Adelie Torgersen 39.5 17.4 186.0 3800.0 female 2007
2 Adelie Torgersen 40.3 18.0 195.0 3250.0 female 2007

Now let’s launch the Explorer using the data accessor method:

explorer = df.hvplot.explorer()
explorer

Understanding the Interface#

The Explorer interface consists of several key areas:

  • Left panel: Controls and settings for customizing your plot

  • Right panel: Live preview of your plot

  • Top section: Status bar with options like “live update”

  • Bottom section: Widgets, error messages and alerts (if any)

Key Controls#

The left panel contains various sections:

  • Fields: Select different chart types (scatter, line, bar, etc.), choose columns for x, y, color, size, etc., select By or Groupby options

  • Axis, Labels, Style: Customize colors, sizes, and visual appearance

  • Operations: Select aggregation options like rasterize, datashade, dynspread etc.

  • Colormapping: Control color options, like selecting a colormap, clim, cnorm and showing a colorbar if available.

  • Geographic: Select geographic options for geo-type plots

  • Advanced: Add additional plots options via the Holoviews .opts() method.

Try changing some of these settings to see how they affect the plot preview.

Creating Your First Plot#

Let’s create a simple scatter plot by configuring some basic settings:

scatter_explorer = df.hvplot.explorer(
    x='bill_length_mm',
    y='bill_depth_mm',
    by=['species'],
    title='Penguin Bill Measurements'
)
scatter_explorer

Even after creating your explorer plot with some pre-configured settings, you can still interact with and modify the parameters of the plot!

Exporting Your Work#

One of the most powerful features of the Explorer is the ability to export your plot configuration as code. This lets you recreate your plot later or use it in scripts. You can access the generated code in several ways:

# Get the code as a string
code = scatter_explorer.code
print("Generated code: \n", code)
Generated code: 
 df.hvplot(
    by=['species'],
    kind='scatter',
    title='Penguin Bill Measurements',
    x='bill_length_mm',
    y=['bill_depth_mm'],
    legend='bottom_right',
    widget_location='bottom',
)

The generated code can be executed directly to recreate your plot:

recreated_plot = scatter_explorer.hvplot()
recreated_plot

You can also get the settings as a dictionary to use with the regular hvplot API:

settings = scatter_explorer.settings()
settings
{'by': ['species'],
 'kind': 'scatter',
 'title': 'Penguin Bill Measurements',
 'x': 'bill_length_mm',
 'y': ['bill_depth_mm']}
# Use the settings with regular hvplot
df.hvplot(**settings)

Working with Different Data Types#

The Explorer works with different data types. Let’s try it with an xarray Dataset:

air_temp = hvplot.sampledata.air_temperature("xarray")
air_temp
<xarray.Dataset> Size: 212kB
Dimensions:  (time: 20, lat: 25, lon: 53)
Coordinates:
  * time     (time) datetime64[ns] 160B 2014-02-24 ... 2014-02-28T18:00:00
  * lat      (lat) float32 100B 75.0 72.5 70.0 67.5 65.0 ... 22.5 20.0 17.5 15.0
  * lon      (lon) float32 212B 200.0 202.5 205.0 207.5 ... 325.0 327.5 330.0
Data variables:
    air      (time, lat, lon) float64 212kB ...
Attributes:
    Conventions:  COARDS
    title:        4x daily NMC reanalysis (1948)
    description:  Data is from NMC initialized reanalysis\n(4x/day).  These a...
    platform:     Model
    references:   http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanaly...
xr_explorer = air_temp.hvplot.explorer(x='lon', y='lat')
xr_explorer

Notice how the Explorer adapts to show options relevant to gridded data, including different plot types like image, quadmesh and contour plots.

Exploring Tabular Data#

Let’s begin with the penguins dataset and explore the relationships between different measurements:

df = hvplot.sampledata.penguins("pandas").dropna()
df.info()
<class 'pandas.DataFrame'>
Index: 333 entries, 0 to 343
Data columns (total 8 columns):
 #   Column             Non-Null Count  Dtype  
---  ------             --------------  -----  
 0   species            333 non-null    str    
 1   island             333 non-null    str    
 2   bill_length_mm     333 non-null    float64
 3   bill_depth_mm      333 non-null    float64
 4   flipper_length_mm  333 non-null    float64
 5   body_mass_g        333 non-null    float64
 6   sex                333 non-null    str    
 7   year               333 non-null    int64  
dtypes: float64(4), int64(1), str(3)
memory usage: 29.3 KB

Starting Your Exploration#

Let’s launch the Explorer and begin investigating the data. We’ll start with a basic scatter plot to look for patterns:

explorer = df.hvplot.explorer()
explorer

While you would normally use the interface controls, for this tutorial we’ll configure the plot programmatically to demonstrate the workflow:

explorer.param.update(
    x='bill_length_mm',
    y_multi=['bill_depth_mm'],
)
explorer.labels.title = 'Penguin Bill Measurements: Bill Depth'

Data exploration is iterative. Let’s change the y-axis to show the Body Mass:

explorer.param.update(y_multi=['body_mass_g'])
explorer.labels.title = 'Penguin Measurements: Body Mass'

The by parameter is powerful for comparing groups. Let’s explore how penguin measurements vary by species:

explorer.param.update( by=['species'])
explorer.labels.title = 'Bill Measurements by Species'

Recording Your Findings#

As you explore, you’ll want to save interesting configurations. Here’s how to capture and reuse your work:

plot_code = explorer.code
print("Code to recreate this plot:\n", plot_code)
Code to recreate this plot:
 df.hvplot(
    by=['species'],
    kind='scatter',
    title='Bill Measurements by Species',
    x='bill_length_mm',
    y=['body_mass_g'],
    legend='bottom_right',
    widget_location='bottom',
)
# Show plot
plot_obj = explorer.hvplot()
plot_obj

Exploring Gridded Data#

The Explorer is also excellent for exploring gridded datasets like climate data. Let’s work with air temperature data:

air_temp = hvplot.sampledata.air_temperature("xarray")
air_temp
<xarray.Dataset> Size: 212kB
Dimensions:  (time: 20, lat: 25, lon: 53)
Coordinates:
  * time     (time) datetime64[ns] 160B 2014-02-24 ... 2014-02-28T18:00:00
  * lat      (lat) float32 100B 75.0 72.5 70.0 67.5 65.0 ... 22.5 20.0 17.5 15.0
  * lon      (lon) float32 212B 200.0 202.5 205.0 207.5 ... 325.0 327.5 330.0
Data variables:
    air      (time, lat, lon) float64 212kB ...
Attributes:
    Conventions:  COARDS
    title:        4x daily NMC reanalysis (1948)
    description:  Data is from NMC initialized reanalysis\n(4x/day).  These a...
    platform:     Model
    references:   http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanaly...

Spatial Visualization#

Let’s explore the spatial patterns in the temperature data:

grid_explorer = air_temp.hvplot.explorer(x='lon', y='lat')
grid_explorer

Notice how the Explorer automatically detects that this is gridded data and offers appropriate plot types like image and contour plots.

Geographic Data Exploration#

When working with geographic data, the Explorer can leverage geographic projections and map tiles:

geo_explorer = air_temp.hvplot.explorer(x='lon', y='lat', geo=True)

geo_explorer.geographic.param.update(
    crs='PlateCarree',
    tiles='CartoDark',
    global_extent=False
)

geo_explorer
/Users/runner/work/hvplot/hvplot/.pixi/envs/docs/lib/python3.13/site-packages/shapely/creation.py:746: RuntimeWarning: invalid value encountered in create_collection
  return lib.create_collection(geometries, np.intc(typ), out=out, **kwargs)
/Users/runner/work/hvplot/hvplot/.pixi/envs/docs/lib/python3.13/site-packages/shapely/creation.py:746: RuntimeWarning: invalid value encountered in create_collection
  return lib.create_collection(geometries, np.intc(typ), out=out, **kwargs)
/Users/runner/work/hvplot/hvplot/.pixi/envs/docs/lib/python3.13/site-packages/shapely/creation.py:746: RuntimeWarning: invalid value encountered in create_collection
  return lib.create_collection(geometries, np.intc(typ), out=out, **kwargs)
/Users/runner/work/hvplot/hvplot/.pixi/envs/docs/lib/python3.13/site-packages/shapely/creation.py:746: RuntimeWarning: invalid value encountered in create_collection
  return lib.create_collection(geometries, np.intc(typ), out=out, **kwargs)
/Users/runner/work/hvplot/hvplot/.pixi/envs/docs/lib/python3.13/site-packages/shapely/creation.py:746: RuntimeWarning: invalid value encountered in create_collection
  return lib.create_collection(geometries, np.intc(typ), out=out, **kwargs)
/Users/runner/work/hvplot/hvplot/.pixi/envs/docs/lib/python3.13/site-packages/shapely/creation.py:746: RuntimeWarning: invalid value encountered in create_collection
  return lib.create_collection(geometries, np.intc(typ), out=out, **kwargs)

Click on the Geographic button to see the ‘Tiles’ and ‘Crs’ options updated

Warning

Using geo=True requires the installation of GeoViews

Advanced Exploration Techniques#

Combining Multiple Variables#

Let’s go back to the penguins data and explore multiple variables simultaneously:

multi_explorer = df.hvplot.explorer()
multi_explorer
multi_explorer.param.update(
    x='flipper_length_mm',
    y_multi=['body_mass_g'],
    by=['species'],
    groupby=['sex'],
)
multi_explorer.labels.title = 'Multi-dimensional Penguin Analysis'

Exploring Distributions#

The Explorer supports various plot types. Let’s explore data distributions:

dist_explorer = df.hvplot.explorer(kind='hist')
dist_explorer
dist_explorer.param.update(
    y_multi=['body_mass_g'],
    by=['species'],
)
dist_explorer.labels.title = 'Body Mass Distribution by Species'

Best Practices for Data Exploration#

  1. Start Simple, Add Complexity. Begin with basic plots and gradually add dimensions (color, size, grouping, etc).

  2. Record Interesting Findings.

  3. Experiment with Different Plot Types. Different plot types reveal different aspects of your data. The Explorer makes it easy to switch between them.

  4. Use the Explorer as a Learning Tool. The generated code helps you learn the hvPlot API. Study the code output to understand how to create plots programmatically.

Workflow Integration#

The Explorer fits naturally into data science workflows:

  1. Initial exploration: Use the Explorer to understand your data

  2. Hypothesis formation: Identify patterns that suggest relationships

  3. Focused analysis: Export promising configurations for further analysis

  4. Presentation: Clean up and refine plots for reports

Conclusion#

The hvPlot Explorer accelerates data exploration by:

  • Eliminating the code-run-adjust cycle

  • Making it easy to try different visualizations

  • Capturing your work for reproducible analysis

  • Teaching you the hvPlot API through generated code

Use the Explorer whenever you’re starting to work with a new dataset or when you need to quickly investigate patterns and relationships in your data.

Next Steps

Now that you know the basics of the Explorer, you can:

  • Experiment with different plot types and settings

  • Try the Explorer with your own datasets

  • Check out the Explorer API reference for all available options

See also

This web page was generated from a Jupyter notebook and not all interactivity will work on this website.