A matplotlib styling package for clean, minimal dataroots themed plots. Works with any visualization tools that builds upon Matplotlib (seaborn, pandas).
pip install rootsstyle
poetry add rootsstyle
Examples
```python 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() ``` | ```python 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. |
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:
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:
.
The CHANGELOG.md file is automatically updated upon any new releases.
This project is licensed under the terms of the MIT license.