seabornxt


Nameseabornxt JSON
Version 0.0.1.dev15 PyPI version JSON
download
home_page
SummaryA few handy extension plots using seaborn API.
upload_time2023-08-17 07:18:30
maintainer
docs_urlNone
authorLeonard Sasse
requires_python>=3.7
license
keywords plotting
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # seabornxt
A few handy extension plots using seaborn API.

## To install:

You can install from PyPI as follows:

``` shell
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:

![Alt text](examples/images/stripboxplot.svg)

## 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:

``` python
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()

```

![Alt text](examples/images/stripboxplot_colors.svg)

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:

``` python
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()

```

![Alt text](examples/images/stripboxplot_penguins.svg)


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "seabornxt",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "plotting",
    "author": "Leonard Sasse",
    "author_email": "l.sasse@fz-juelich.de",
    "download_url": "https://files.pythonhosted.org/packages/8a/8e/9d52dc83eab52d15360b118f7e32356bcad2cd807ec7ca3415a81e232ca8/seabornxt-0.0.1.dev15.tar.gz",
    "platform": null,
    "description": "# seabornxt\nA few handy extension plots using seaborn API.\n\n## To install:\n\nYou can install from PyPI as follows:\n\n``` shell\npip install seabornxt\n```\n\nor you can install it from the GitHub repository:\n\n```\ngit clone https://github.com/LeSasse/seabornxt.git\ncd seabornxt\npip install .\n\n```\n\n## Use example:\n\n```\nimport seaborn as sns\nfrom seabornxt import stripboxplot\n\n\ndef main():\n    tips = sns.load_dataset(\"tips\")\n\n    plot = stripboxplot(data=tips, x=\"day\", y=\"total_bill\", hue=\"smoker\")\n    fig = plot.get_figure()\n    fig.savefig(\"stripboxplot.pdf\")\n\n\nif __name__ == \"__main__\":\n    main()\n\n```\n\nResults in:\n\n![Alt text](examples/images/stripboxplot.svg)\n\n## Customise box and strip plots:\n\nYou can customise the box and strip plots by passing over the\n`strip_kwargs` and `box_kwargs` dictionaries. The following\nexample displays data points in the same colour as the box plots:\n\n``` python\nimport seaborn as sns\nfrom seabornxt import stripboxplot\n\n\ndef main():\n    tips = sns.load_dataset(\"tips\")\n\n    plot = stripboxplot(\n        data=tips,\n        x=\"day\",\n        y=\"total_bill\",\n        hue=\"smoker\",\n        strip_kwargs={\"jitter\": True, \"alpha\": 0.8},\n        box_kwargs={\"boxprops\": {\"alpha\": 0.4}},\n    )\n    fig = plot.get_figure()\n    fig.savefig(\"stripboxplot_colors.svg\")\n\n\nif __name__ == \"__main__\":\n    main()\n\n```\n\n![Alt text](examples/images/stripboxplot_colors.svg)\n\nThe reason for this is that if no `strip_kwargs` are handed over, I set the color\nof the points to black for better visibility by default. But if one hands over \n`strip_kwargs`, without explicitly specifying a color, the strip plot goes back\nto the seaborn default color/hue. I prefer black as a default as this is most\nuseful in my use cases.\n\n## Another dataset:\n\n``` python\nimport seaborn as sns\nfrom seabornxt import stripboxplot\n\n\ndef main():\n    penguins = sns.load_dataset(\"penguins\")\n    plot = stripboxplot(\n        data=penguins,\n        x=\"sex\",\n        y=\"body_mass_g\",\n        hue=\"species\",\n    )\n    fig = plot.get_figure()\n    fig.savefig(\"stripboxplot_penguins.svg\")\n\n\nif __name__ == \"__main__\":\n    main()\n\n```\n\n![Alt text](examples/images/stripboxplot_penguins.svg)\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A few handy extension plots using seaborn API.",
    "version": "0.0.1.dev15",
    "project_urls": {
        "repository": "https://github.com/LeSasse/seabornxt.git"
    },
    "split_keywords": [
        "plotting"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bb23c858aaa58d04ac5b5c6951d7e006758e1cd77824a7aa1d2097f0b7ca7d6c",
                "md5": "482764703583a63a728c8123f37a6656",
                "sha256": "20106ff73fa817f133991427873b9da9b1e902e414b9bbffa1a98d6d7a93e3a1"
            },
            "downloads": -1,
            "filename": "seabornxt-0.0.1.dev15-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "482764703583a63a728c8123f37a6656",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 15627,
            "upload_time": "2023-08-17T07:18:29",
            "upload_time_iso_8601": "2023-08-17T07:18:29.514196Z",
            "url": "https://files.pythonhosted.org/packages/bb/23/c858aaa58d04ac5b5c6951d7e006758e1cd77824a7aa1d2097f0b7ca7d6c/seabornxt-0.0.1.dev15-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8a8e9d52dc83eab52d15360b118f7e32356bcad2cd807ec7ca3415a81e232ca8",
                "md5": "eebd98cbac3de4b880468567445ed59d",
                "sha256": "5eeb2c4fa46f322d07a4ba24b989107f8553769af9a7242d1e0d3df29ca94e53"
            },
            "downloads": -1,
            "filename": "seabornxt-0.0.1.dev15.tar.gz",
            "has_sig": false,
            "md5_digest": "eebd98cbac3de4b880468567445ed59d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 51063,
            "upload_time": "2023-08-17T07:18:30",
            "upload_time_iso_8601": "2023-08-17T07:18:30.969556Z",
            "url": "https://files.pythonhosted.org/packages/8a/8e/9d52dc83eab52d15360b118f7e32356bcad2cd807ec7ca3415a81e232ca8/seabornxt-0.0.1.dev15.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-17 07:18:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "LeSasse",
    "github_project": "seabornxt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "seabornxt"
}
        
Elapsed time: 0.10092s