{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Plotly Express Gallery\n",
"\n",
"Plotly Express is a terse, consistent, high-level wrapper around [Plotly.py](https://plot.ly/python) for rapid data exploration and figure generation.\n",
"\n",
"This notebook demonstrates various `plotly_express` features. [Reference documentation](https://plotly.github.io/plotly_express/plotly_express/) and a [step by step walkthrough notebook](https://nbviewer.jupyter.org/github/plotly/plotly_express/blob/master/walkthrough.ipynb) are also available.\n",
"\n",
"You can also read our [Medium announcement article](https://medium.com/@plotlygraphs/introducing-plotly-express-808df010143d) for more information on this library."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## A single import"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import plotly_express as px"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Built-in sample datasets"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Each row represents a flower.\n",
"\n",
" https://en.wikipedia.org/wiki/Iris_flower_data_set\n",
"\n",
" Returns:\n",
" A `pandas.DataFrame` with 150 rows and the following columns: `['sepal_length', 'sepal_width', 'petal_length', 'petal_width', 'species',\n",
" 'species_id']`.\n",
" \n"
]
}
],
"source": [
"print(px.data.iris.__doc__)\n",
"iris = px.data.iris()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"tips = px.data.tips()\n",
"gapminder = px.data.gapminder()\n",
"election = px.data.election()\n",
"wind = px.data.wind()\n",
"carshare = px.data.carshare()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Scatter and Line plots"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/vnd.plotly.v1+html": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"linkText": "Export to plot.ly",
"plotlyServerURL": "https://plot.ly",
"showLink": false
},
"data": [
{
"hovertemplate": "sepal_width=%{x}
sepal_length=%{y}