A few handy extension plots using seaborn API.
Project description
seabornxt
A few handy extension plots using seaborn API.
To install:
You can install from PyPI as follows:
pip install seabornxt
or you can install it from the GitHub repository:
git clone https://github.com/LeSasse/seabornxt.git
cd seabornxt
pip install .
Use example:
import seaborn as sns
from seabornxt import stripboxplot
def main():
tips = sns.load_dataset("tips")
plot = stripboxplot(data=tips, x="day", y="total_bill", hue="smoker")
fig = plot.get_figure()
fig.savefig("stripboxplot.pdf")
if __name__ == "__main__":
main()
Results in:
Customise box and strip plots:
You can customise the box and strip plots by passing over the
strip_kwargs
and box_kwargs
dictionaries. The following
example displays data points in the same colour as the box plots:
import seaborn as sns
from seabornxt import stripboxplot
def main():
tips = sns.load_dataset("tips")
plot = stripboxplot(
data=tips,
x="day",
y="total_bill",
hue="smoker",
strip_kwargs={"jitter": True, "alpha": 0.8},
box_kwargs={"boxprops": {"alpha": 0.4}},
)
fig = plot.get_figure()
fig.savefig("stripboxplot_colors.svg")
if __name__ == "__main__":
main()
The reason for this is that if no strip_kwargs
are handed over, I set the color
of the points to black for better visibility by default. But if one hands over
strip_kwargs
, without explicitly specifying a color, the strip plot goes back
to the seaborn default color/hue. I prefer black as a default as this is most
useful in my use cases.
Another dataset:
import seaborn as sns
from seabornxt import stripboxplot
def main():
penguins = sns.load_dataset("penguins")
plot = stripboxplot(
data=penguins,
x="sex",
y="body_mass_g",
hue="species",
)
fig = plot.get_figure()
fig.savefig("stripboxplot_penguins.svg")
if __name__ == "__main__":
main()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file seabornxt-0.0.1.dev14.tar.gz
.
File metadata
- Download URL: seabornxt-0.0.1.dev14.tar.gz
- Upload date:
- Size: 51.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da340dcdf88e461f88fecd3f6a7fd412c36a0b0442c6f4d41d7c0221bdc2ba22 |
|
MD5 | 7233481860ecc7da9066719aab9c536d |
|
BLAKE2b-256 | a0db2232d967ae3eace6a5abd4b1e6eb4819aebd7b6b7ec8ca6dc94c0ee89dc3 |
File details
Details for the file seabornxt-0.0.1.dev14-py3-none-any.whl
.
File metadata
- Download URL: seabornxt-0.0.1.dev14-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef11cc6326e779721961840ada82e54e66193d66bf89d81222c36c7cbeaacb1f |
|
MD5 | d8c38a43bd116558b576e898d4649191 |
|
BLAKE2b-256 | 60be7deca8bf19e985cbf83b6a4b2c68d0527928d7a7e82f7cbd7e6ea408ce2f |