Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert color palette docstrings to notebooks #3034

Merged
merged 9 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,14 @@ jobs:
strategy:
matrix:
python: ["3.7", "3.8", "3.9", "3.10"]
target: [test]
install: [full]
deps: [latest]

include:
- python: "3.7"
target: unittests
install: full
deps: pinned
- python: "3.10"
target: unittests
install: light
deps: latest

Expand All @@ -83,7 +80,7 @@ jobs:
pip install .[dev$EXTRAS] $DEPS

- name: Run tests
run: make ${{ matrix.target }}
run: make test

- name: Upload coverage
uses: codecov/codecov-action@v2
Expand Down
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
export SHELL := /bin/bash

test:
pytest -n auto --doctest-modules --cov=seaborn --cov=tests --cov-config=.coveragerc seaborn tests

unittests:
pytest -n auto --cov=seaborn --cov=tests --cov-config=.coveragerc tests

lint:
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,9 @@ Testing

Testing seaborn requires installing additional dependencies; they can be installed with the `dev` extra (e.g., `pip install .[dev]`).

To test the code, run `make test` in the source directory. This will exercise both the unit tests and docstring examples (using [pytest](https://docs.pytest.org/)) and generate a coverage report.
To test the code, run `make test` in the source directory. This will exercise the unit tests (using [pytest](https://docs.pytest.org/)) and generate a coverage report.

The doctests require a network connection (unless all example datasets are cached), but the unit tests can be run offline with `make unittests`.

Code style is enforced with `flake8` using the settings in the [`setup.cfg`](./setup.cfg) file. Run `make lint` to check. Alternately, you can use `pre-commit` to automatically run lint checks on any files you are committing – just run `pre-commit install` to set it up, and then commit as usual going forward.
Code style is enforced with `flake8` using the settings in the [`setup.cfg`](./setup.cfg) file. Run `make lint` to check. Alternately, you can use `pre-commit` to automatically run lint checks on any files you are committing: just run `pre-commit install` to set it up, and then commit as usual going forward.

Development
-----------
Expand Down
6 changes: 3 additions & 3 deletions doc/_docstrings/FacetGrid.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "seaborn-py39-latest",
"display_name": "py310",
"language": "python",
"name": "seaborn-py39-latest"
"name": "py310"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -294,7 +294,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.10.0"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions doc/_docstrings/JointGrid.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "seaborn-py39-latest",
"display_name": "py310",
"language": "python",
"name": "seaborn-py39-latest"
"name": "py310"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -236,7 +236,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.10.0"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions doc/_docstrings/PairGrid.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "seaborn-py39-latest",
"display_name": "py310",
"language": "python",
"name": "seaborn-py39-latest"
"name": "py310"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -263,7 +263,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.10.0"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions doc/_docstrings/axes_style.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "seaborn-py39-latest",
"display_name": "py310",
"language": "python",
"name": "seaborn-py39-latest"
"name": "py310"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -94,7 +94,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.10.0"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions doc/_docstrings/barplot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "seaborn-py39-latest",
"display_name": "py310",
"language": "python",
"name": "seaborn-py39-latest"
"name": "py310"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -117,7 +117,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.10.0"
}
},
"nbformat": 4,
Expand Down
103 changes: 103 additions & 0 deletions doc/_docstrings/blend_palette.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "8f97280e-cec8-42b2-a968-4fd4364594f8",
"metadata": {
"tags": [
"hide"
]
},
"outputs": [],
"source": [
"import seaborn as sns\n",
"sns.set_theme()\n",
"sns.palettes._patch_colormap_display()"
]
},
{
"cell_type": "raw",
"id": "972edede-df1a-4010-9674-00b864d020e2",
"metadata": {},
"source": [
"Pass a list of two colors to interpolate between them:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e6ae2547-1042-4ac0-84ea-6f37a0229871",
"metadata": {},
"outputs": [],
"source": [
"sns.blend_palette([\"b\", \"r\"])"
]
},
{
"cell_type": "raw",
"id": "1d983eac-2dd5-4746-b27f-4dfa19b5e091",
"metadata": {},
"source": [
"The color list can be arbitrarily long, and any color format can be used:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "846b78fd-30ce-4507-93f4-4274122c1987",
"metadata": {},
"outputs": [],
"source": [
"sns.blend_palette([\"#45a872\", \".8\", \"xkcd:golden\"])"
]
},
{
"cell_type": "raw",
"id": "318fef32-1f83-44d9-9ff9-21fa0231b7c6",
"metadata": {},
"source": [
"Return a continuous colormap instead of a discrete palette:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f0a05bc3-c60b-47a1-b276-d2e28a4a8226",
"metadata": {},
"outputs": [],
"source": [
"sns.blend_palette([\"#bdc\", \"#7b9\", \"#47a\"], as_cmap=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0473a402-0ec2-4877-81d2-ed6c57aefc77",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "py310",
"language": "python",
"name": "py310"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
6 changes: 3 additions & 3 deletions doc/_docstrings/boxenplot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "seaborn-py39-latest",
"display_name": "py310",
"language": "python",
"name": "seaborn-py39-latest"
"name": "py310"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -122,7 +122,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.10.0"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions doc/_docstrings/boxplot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "seaborn-py39-latest",
"display_name": "py310",
"language": "python",
"name": "seaborn-py39-latest"
"name": "py310"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -165,7 +165,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.10.0"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions doc/_docstrings/catplot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "seaborn-py39-latest",
"display_name": "py310",
"language": "python",
"name": "seaborn-py39-latest"
"name": "py310"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -182,7 +182,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.10.0"
}
},
"nbformat": 4,
Expand Down
Loading