{
"cells": [
{
"cell_type": "markdown",
"id": "44877a38-b5b2-4ed4-8a59-7fe3571f03fa",
"metadata": {},
"source": [
"# explorer"
]
},
{
"cell_type": "markdown",
"id": "a8d569ea",
"metadata": {},
"source": [
"The *Explorer* is a [Panel](https://panel.holoviz.org)-based web application with which you can easily explore your data. While using `.hvplot()` is a convenient way to create plots from data, it assumes some *a piori* knowledge about the data itself and its structure, and also knowdlege about `.hvplot()`'s API itself. The *Explorer* is a graphical interface that offers a simple way to select and visualize the kind of plot you want to see your data with, and many options to customize that plot."
]
},
{
"cell_type": "markdown",
"id": "e5f15c29-1e4e-4965-88cd-b2bc844ea1a7",
"metadata": {},
"source": [
":::{note}\n",
"The Explorer has been added to hvPlot in version 0.8.0
with support for Pandas objects. Support for Xarray objects has been added in version 0.9.0
. Support for more data types will be added in future versions, in the meantime please report any issue or feature request on GitHub.\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "ddd88f96-1fe4-4990-90f6-b3ba8de51f23",
"metadata": {},
"source": [
"## Set up"
]
},
{
"cell_type": "markdown",
"id": "433023f4-5ebc-4585-9fc8-1c3f26cfd880",
"metadata": {},
"source": [
"Setting up the explorer is pretty simple in a notebook, you just need to make sure you have loaded the extension, either via a data type import (e.g. `import hvplot.pandas`) or directly (e.g. `hvplot.extension('bokeh')`)."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8dad379b-fcbf-4f18-84ec-6c0a07187f4d",
"metadata": {},
"outputs": [],
"source": [
"import hvplot.pandas # noqa"
]
},
{
"cell_type": "markdown",
"id": "4ec628be-25e5-42d7-9ef5-6419c78b5140",
"metadata": {},
"source": [
"## Basic usage"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8f88635d-63a4-414c-a0ea-72605e0c896f",
"metadata": {},
"outputs": [],
"source": [
"from bokeh.sampledata.penguins import data as df\n",
"\n",
"df.head(2)"
]
},
{
"cell_type": "markdown",
"id": "8d638734-0a96-4d7a-8b9f-9c46403a0b3f",
"metadata": {},
"source": [
"The explorer is available on the `.hvplot` namespace together with the other plotting methods. It accepts most of the parameters accepted by the `.hvplot()` API. For the purpose of producing a nice example on the documentation we will instantiate an explorer with some pre-defined parameters; usually you would instantiate it without so many parameters."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e9c01a9f",
"metadata": {},
"outputs": [],
"source": [
"explorer = df.hvplot.explorer(x='bill_length_mm', y='bill_depth_mm', by=['species'])\n",
"explorer"
]
},
{
"cell_type": "markdown",
"id": "2fc85ce5-3c79-4e2f-8600-38d97122ffe7",
"metadata": {},
"source": [
"Spend some time browser the explorer and the options it offers. On this webpage it's not going to update the preview plot and code interactively, as it needs an active Python kernel, but you will get a good feeling of all you can do with it."
]
},
{
"cell_type": "markdown",
"id": "99aee979",
"metadata": {},
"source": [
"Once you are done exploring the data you may want to record the settings you have configured or save the plot. The easiest option consists of opening the *Code* tab next to *Plot* and copy/pasting the code displayed in a new notebook cell, executing it will generate exactly the same code as seen in the explorer.\n",
"\n",
"The code string is also available on the `code` attribute:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5b59f550-7d99-44a0-bc96-4e7131daafcd",
"metadata": {},
"outputs": [],
"source": [
"eval(explorer.code)"
]
},
{
"cell_type": "markdown",
"id": "2a3f891b-214f-4635-84a5-bd425df7c8db",
"metadata": {},
"source": [
"## Conclusion"
]
},
{
"cell_type": "markdown",
"id": "0dbb3916",
"metadata": {},
"source": [
"For information on using `.hvplot.explorer()` take a look at the [User Guide](../user_guide/Explorer.ipynb)."
]
}
],
"metadata": {
"language_info": {
"name": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}