Skip to content

Commit

Permalink
feat: add subplots
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislemke authored Dec 30, 2022
1 parent 587770c commit 8c537a3
Show file tree
Hide file tree
Showing 27 changed files with 594 additions and 232 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: deepakputhraya/action-pr-title@master
with:
regex: "^(build:|ci:|docs:|feat:|fix:|perf:|refactor:|revert:|style:|test:|security:).{12,30}$"
regex: "^(build:|ci:|docs:|feat:|fix:|bug:|perf:|refactor:|revert:|style:|test:|security:).{12,60}$"
min_length: 10
max_length: 20
max_length: 60
github_token: "${{ secrets.GITHUB_TOKEN }}"
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
prerelease: true
default-branch: main
pull-request-header: ":robot: I have created a release *beep* *boop*. This was predictable."
changelog-types: '[{"type":"add","section":"Features","hidden":false},{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":true},{"type":"test","section":"Tests","hidden":false},{"type":"ci","section":"CI/CD","hidden":false},{"type":"refactor","section":"Maintenance","hidden":false},{"type":"perf","section":"Maintenance","hidden":false},{"type":"revert","section":"Maintenance","hidden":false},{"type":"docs","section":"Documentation","hidden":false},{"type":"security","section":"Security","hidden":false}]'
changelog-types: '[{"type":"resolve","section":"Miscellaneous","hidden":true},{"type":"add","section":"Features","hidden":false},{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"bug","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":true},{"type":"test","section":"Tests","hidden":false},{"type":"ci","section":"CI/CD","hidden":false},{"type":"refactor","section":"Maintenance","hidden":false},{"type":"perf","section":"Maintenance","hidden":false},{"type":"revert","section":"Maintenance","hidden":false},{"type":"docs","section":"Documentation","hidden":false},{"type":"security","section":"Security","hidden":false}]'
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ repos:
"test",
"security",
"perf",
"resolve"
]

- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
File renamed without changes.
10 changes: 8 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ poetry install
| [`scatter`](https://invia-flights.github.io/blitzly/plots/scatter/) | [`scatter_matrix`](https://invia-flights.github.io/blitzly/plots/scatter/#blitzly.plots.scatter.scatter_matrix) | Plots a scatter matrix. |
| [`scatter`](https://invia-flights.github.io/blitzly/plots/scatter/) | [`multi_scatter`](https://invia-flights.github.io/blitzly/plots/scatter/#blitzly.plots.scatter.multi_scatter) | Create a multi scatter plot. It can be used to visualize the relationship between multiple variables from the same Pandas DataFrame. |

### Subplots 👨‍👩‍👧‍👦

| Module | Method | Description |
| ------ | ------ | ----------- |
| [`subplots`](https://invia-flights.github.io/blitzly/plots/subplots/) | [`make_subplots`](https://invia-flights.github.io/blitzly/plots/subplots/#blitzly.subplots.make_subplots) | Create subplots using figure objects created with any of the above available plots. |

## Usage 🤌
Here are some examples. You can also check out the [playground notebook](https://github.com/invia-flights/blitzly/blob/main/examples/playground.ipynb) 📒.

Expand Down Expand Up @@ -96,10 +102,10 @@ Gives you this:
diagonal_visible=False,
marker_color_scale="Rainbow",
marker_line_color="blue",
size=500,
size=(500, 500),
)
```
Gives you:
Gives you this:

<img src="https://github.com/invia-flights/blitzly/raw/main/docs/assets/images/example_plots/scatter_matrix.png" alt="scatter-matrix plot" width="500" height="500"/>

Expand Down
1 change: 1 addition & 0 deletions docs/plots/subplots.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: blitzly.subplots
33 changes: 27 additions & 6 deletions examples/playground.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"data = np.array([[8, 3, 6], [9, 7, 5]])\n",
"error_array = np.array([[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]])\n",
"\n",
"fig = multi_bar(\n",
"fig_multibar = multi_bar(\n",
" data,\n",
" x_labels=[\"Vienna\", \"Berlin\", \"Lisbon\"],\n",
" group_labels=[\"Personal rating\", \"Global rating\"],\n",
Expand All @@ -68,7 +68,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(fig)"
"print(fig_multibar)"
]
},
{
Expand Down Expand Up @@ -146,7 +146,7 @@
"index = [f\"category {i+1} ⚡️\" for i in range(10)]\n",
"df = pd.DataFrame(data, index=index)\n",
"\n",
"fig = simple_dumbbell(df, title=\"My first dumbbell plot 🤓\")"
"fig_dumbbell = simple_dumbbell(df, title=\"My first dumbbell plot 🤓\")"
]
},
{
Expand Down Expand Up @@ -179,6 +179,27 @@
")"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Subplots\n",
"\n",
"Combine any of the previously-created figures as subplots in the same figure!"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from blitzly.subplots import make_subplots\n",
"\n",
"_ = make_subplots([fig_multibar, fig_dumbbell, fig_dumbbell, fig_multibar], (2, 2))"
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand All @@ -190,7 +211,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "autoembedder",
"display_name": "blitzly",
"language": "python",
"name": "python3"
},
Expand All @@ -204,11 +225,11 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.11.0"
},
"vscode": {
"interpreter": {
"hash": "950ba396633c7210a34f742c6b1745f808a43c09714e8882a4536677dfcbb43b"
"hash": "f4fa492d61aa4bd4bbaeb19b5818168dde89106ff3309a91e7db70fcb63410b9"
}
}
},
Expand Down
Loading

0 comments on commit 8c537a3

Please sign in to comment.