Skip to content

Commit

Permalink
Convert relational model API examples to use notebooks (#2201)
Browse files Browse the repository at this point in the history
* Update scatterplot API docs to use notebook

* Convert lineplot API examples to notebook

* Convert relplot API examples to use notebook

* Improve notebook processing, don't remove html output

* Start improving lineplot API examples

* Improve (?) lineplot API examples

* Improve scatterplot API examples

* Hide import cells in distribution plot API examples

* Demo using FacetGrid in relplot docs

* Fix doc bugs

[ci skip]
  • Loading branch information
mwaskom committed Aug 18, 2020
1 parent bccfb29 commit d6e94a6
Show file tree
Hide file tree
Showing 10 changed files with 1,064 additions and 395 deletions.
1 change: 1 addition & 0 deletions doc/_static/style.css
Expand Up @@ -26,6 +26,7 @@ blockquote {
}

pre {
margin-top: 11.5px !important;
background-color: #f6f6f9 !important;
}

Expand Down
27 changes: 16 additions & 11 deletions doc/docstrings/displot.ipynb
@@ -1,7 +1,20 @@
{
"cells": [
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"hide"
]
},
"outputs": [],
"source": [
"import seaborn as sns; sns.set(style=\"ticks\")"
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"The default plot kind is a histogram:"
Expand All @@ -13,13 +26,12 @@
"metadata": {},
"outputs": [],
"source": [
"import seaborn as sns; sns.set(style=\"ticks\")\n",
"penguins = sns.load_dataset(\"penguins\")\n",
"sns.displot(data=penguins, x=\"flipper_length_mm\")"
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"Use the ``kind`` parameter to select a different representation:"
Expand Down Expand Up @@ -115,7 +127,7 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"Each kind of plot can be drawn separately for subsets of data using ``hue`` mapping:"
Expand Down Expand Up @@ -201,13 +213,6 @@
"g.set_axis_labels(\"Density (a.u.)\", \"Flipper length (mm)\")\n",
"g.set_titles(\"{col_name} penguins\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
14 changes: 13 additions & 1 deletion doc/docstrings/ecdfplot.ipynb
Expand Up @@ -7,13 +7,25 @@
"Plot a univariate distribution along the x axis:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"hide"
]
},
"outputs": [],
"source": [
"import seaborn as sns; sns.set()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import seaborn as sns; sns.set()\n",
"penguins = sns.load_dataset(\"penguins\")\n",
"sns.ecdfplot(data=penguins, x=\"flipper_length_mm\")"
]
Expand Down
23 changes: 18 additions & 5 deletions doc/docstrings/histplot.ipynb
@@ -1,10 +1,24 @@
{
"cells": [
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"hide"
]
},
"outputs": [],
"source": [
"import seaborn as sns\n",
"sns.set(style=\"white\")"
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"Plot a univariate distribution along the x axis:"
"Assign a variable to ``x`` to plot a univariate distribution along the x axis:"
]
},
{
Expand All @@ -13,7 +27,6 @@
"metadata": {},
"outputs": [],
"source": [
"import seaborn as sns; sns.set(style=\"white\")\n",
"penguins = sns.load_dataset(\"penguins\")\n",
"sns.histplot(data=penguins, x=\"flipper_length_mm\")"
]
Expand Down Expand Up @@ -231,10 +244,10 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"For heavily skewed distributions, it's better to define the bins in log space. Compare:"
"Real-world data is often skewed. For heavily skewed distributions, it's better to define the bins in log space. Compare:"
]
},
{
Expand Down
14 changes: 13 additions & 1 deletion doc/docstrings/kdeplot.ipynb
@@ -1,5 +1,18 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"hide"
]
},
"outputs": [],
"source": [
"import seaborn as sns; sns.set()"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -13,7 +26,6 @@
"metadata": {},
"outputs": [],
"source": [
"import seaborn as sns; sns.set()\n",
"tips = sns.load_dataset(\"tips\")\n",
"sns.kdeplot(data=tips, x=\"total_bill\")"
]
Expand Down

0 comments on commit d6e94a6

Please sign in to comment.