Skip to content

Commit

Permalink
Docs gallery (#21)
Browse files Browse the repository at this point in the history
* label examples for gallery, give some titles

* add examples for geom_area, labs, and theme_classic
  • Loading branch information
machow authored Mar 1, 2024
1 parent 675f2af commit ba5dc3c
Show file tree
Hide file tree
Showing 12 changed files with 321 additions and 3 deletions.
69 changes: 69 additions & 0 deletions plotnine_examples/examples/geom_area.ipynb

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions plotnine_examples/examples/geom_bar.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@
"mpg.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Simple barchart counts"
]
},
{
"cell_type": "code",
"execution_count": 3,
Expand All @@ -192,6 +199,7 @@
}
],
"source": [
"# Gallery, distributions\n",
"ggplot(mpg) + geom_bar(aes(x=\"class\"))"
]
},
Expand Down Expand Up @@ -227,6 +235,13 @@
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Complex barchart counts"
]
},
{
"cell_type": "code",
"execution_count": 5,
Expand All @@ -253,6 +268,7 @@
}
],
"source": [
"# Gallery, distributions\n",
"(\n",
" ggplot(mpg) \n",
" + geom_bar(aes(x=\"class\", fill=\"drv\"))\n",
Expand Down
1 change: 1 addition & 0 deletions plotnine_examples/examples/geom_boxplot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
}
],
"source": [
"# Gallery, distributions\n",
"(\n",
" ggplot(flights)\n",
" + geom_boxplot(aes(x=\"factor(month)\", y=\"passengers\"))\n",
Expand Down
3 changes: 2 additions & 1 deletion plotnine_examples/examples/geom_density.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
}
],
"source": [
"# Gallery, distributions\n",
"(\n",
" ggplot(mpg, aes(x=\"cty\", color=\"drv\", fill=\"drv\"))\n",
" + geom_density(alpha=0.1)\n",
Expand Down Expand Up @@ -665,7 +666,7 @@
}
],
"source": [
"# Gallery, areas\n",
"# Gallery, distributions\n",
"\n",
"class geom_density_highlight(geom_density):\n",
" def __init__(self, *args, region=(-np.inf, np.inf), **kwargs):\n",
Expand Down
3 changes: 3 additions & 0 deletions plotnine_examples/examples/geom_histogram.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Basic Histogram\n",
"\n",
"If you create a basic histogram, you will be prompted to define the binwidth or number of bins."
]
},
Expand Down Expand Up @@ -224,6 +226,7 @@
}
],
"source": [
"# Gallery, distributions\n",
"(\n",
" ggplot(diamonds, aes(x=\"carat\"))\n",
" + geom_histogram()\n",
Expand Down
8 changes: 8 additions & 0 deletions plotnine_examples/examples/geom_line.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@
"economics.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Simple line chart"
]
},
{
"cell_type": "code",
"execution_count": 3,
Expand All @@ -162,6 +169,7 @@
}
],
"source": [
"# Gallery, lines\n",
"(\n",
" ggplot(economics, aes(x=\"date\", y=\"uempmed\"))\n",
" + geom_line() # line plot\n",
Expand Down
1 change: 1 addition & 0 deletions plotnine_examples/examples/geom_path.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@
}
],
"source": [
"# Gallery, lines\n",
"# input\n",
"legend_breaks = [\n",
" -79056000000000000,\n",
Expand Down
3 changes: 2 additions & 1 deletion plotnine_examples/examples/geom_point.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Basic scatter plot"
"### Basic scatter plot"
]
},
{
Expand Down Expand Up @@ -191,6 +191,7 @@
}
],
"source": [
"# Gallery, points\n",
"p = ggplot(aes(x=\"displ\", y=\"cty\"), mpg)\n",
"p + geom_point()"
]
Expand Down
9 changes: 8 additions & 1 deletion plotnine_examples/examples/geom_smooth.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,13 @@
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Scatterplot with linear model"
]
},
{
"cell_type": "code",
"execution_count": 7,
Expand All @@ -353,7 +360,7 @@
}
],
"source": [
"# Gallery, variations\n",
"# Gallery, points\n",
"\n",
"(\n",
" ggplot(mpg, aes(x=\"displ\", y=\"hwy\", color=\"factor(drv)\"))\n",
Expand Down
1 change: 1 addition & 0 deletions plotnine_examples/examples/geom_vline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@
}
],
"source": [
"# Gallery, points\n",
"(\n",
" ggplot(mpg, aes(x=\"displ\", y=\"hwy\"))\n",
" + geom_point()\n",
Expand Down
102 changes: 102 additions & 0 deletions plotnine_examples/examples/labs.ipynb

Large diffs are not rendered by default.

108 changes: 108 additions & 0 deletions plotnine_examples/examples/theme_classic.ipynb

Large diffs are not rendered by default.

0 comments on commit ba5dc3c

Please # to comment.