A dataroots inspired theme for matplotlib.
Project description
rootsstyle
A matplotlib styling package for clean, minimal dataroots themed plots. Works with any visualization tools that builds upon Matplotlib (seaborn, pandas).
Installation
using pip
pip install rootsstyle
using poetry
poetry add rootsstyle
Usage
Examples
import rootsstyle
import matplotlib.pyplot as plt
plt.style.use(rootsstyle.style)
y, y2 = [3, 8, 1, 10], [8, 3, 10, 2]
plt.plot(y, label='y')
plt.plot(y2, label='y2', linestyle = 'dotted')
rootsstyle.ylabel('yvalues')
plt.xlabel('x-label')
rootsstyle.legend()
plt.title('Example plot')
plt.show()
|
import rootsstyle
import matplotlib.pyplot as plt
plt.style.use(rootsstyle.style)
languages = ['C', 'C++', 'Java', 'Python', 'PHP']
students = [23,17,35,29,12]
plt.bar(languages, students)
plt.xlabel('Language')
rootsstyle.show_bar_values()
plt.title('Example barplot')
plt.show()
|
STYLING
import rootsstyle
import matplotlib.pyplot as plt
# globally
plt.style.use(rootsstyle.style)
# within context manager
with plt.style.context(rootsstyle.style):
# ...
FUNCTIONS
-
Place the legend to the right of the plot.
For lineplots, place the legend entries right of the corresponding line.rootsstyle.legend(handles=None, labels=None, title=None)
-
Place the y-label above the y-axis and rotate it, so that it is horizontal.
rootsstyle.ylabel(ylabel: str)
-
Show barvalues at each bar.
Removes the y-axis (optional).
Bar values can be shown just 'below' the top of each bar, or just 'above' each bar.rootsstyle.show_bar_values(remove_y_axis=True, fontsize=12, position="below", fmt="{:.0f}")
COLOR PALETTE
The color palettes are added to the global matplotlib color registry. You can thus easily use a palette by simply providing the name in the correct location. |
VERSIONING
A semantic versioning scheme is used to update the version on the commit messages. This happens automatically on any push to the main branch. Only patches, minor and major changes will generate a tag, release and publishing of the package. We stick to the default Angular Commit Message Conventions. To use this system, commit messages should adhere to a couple of rules:
-
Commits must follow the following syntax
<type>(<scope>): <subject> <BLANK LINE> <body> <BLANK LINE> <footer>
-
Type should be one of the following:
- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code (formatting, missing semi-colons, etc)
- refactor: A code change that neither fixes a bug nor adds a feature
- perf: A code change that improves performance
- test: Adding missing or correcting existing tests
- chore: Changes to the build process or auxiliary tools and libraries such as documentation generation
-
Body (optional) is used to motivate the change
-
Footer (optional) is used to link to any issues that the commit closes and for breaking changes, in which case the line should start with
BREAKING CHANGE:
.
CHANGELOG
The CHANGELOG.md file is automatically updated upon any new releases.
License
This project is licensed under the terms of the MIT license.
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
Hashes for rootsstyle-0.5.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 697c76e32297009940aeb140cbd326f9d1d7e4a23acd44805feb8d678a33140f |
|
MD5 | 47625275c65f5035ac1f6eb48e81e5c3 |
|
BLAKE2b-256 | 90dc25676b7df9d28bc7592819605700a6aa795e02981df5fc422bcc779672b2 |