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

Feature request: Distribute .mplstyle files #54

Open
joooeey opened this issue Dec 11, 2024 · 0 comments
Open

Feature request: Distribute .mplstyle files #54

joooeey opened this issue Dec 11, 2024 · 0 comments

Comments

@joooeey
Copy link

joooeey commented Dec 11, 2024

The dufte style looks nice for use with cantools because of the thin lines. Cantools uses a command line script for plotting where one can specify a plotting style with e.g. --style ggplot. I'd like to use --style matplotx.dufte instead (I also tried --style matplotx.styles.dufte). Unfortunately this doesn't work because matplotx doesn't distribute .mplstyle sheets as suggested by the matplotlib API.

I'd like the following to work:

$ mamba install cantools matplotx
$ cantools plot --list-styles .
available matplotlib styles:
- Solarize_Light2
- _classic_test_patch
- _mpl-gallery
- _mpl-gallery-nogrid
- bmh
- classic
[...]
- seaborn-v0_8-white
- seaborn-v0_8-whitegrid
- tableau-colorblind10
- matplotx.aura
- matplotx.ayu
- matplotx.challenger_deep
- matplotx.dhaitz
- matplotx.dracula
- matplotx.dufte
[...]
- matplotx.tokyo_night

However, as it is now, I don't get the matplotx styles.

Then I could run commands like cat can*.log | python -m cantools plot signal_database.dbc * --style matplotx.dufte and get plots with nice thin linewidths.

This is just one use case. I would think there are plenty of other use cases. A trivial one would be that if matplotx distributes .mplstyle sheets, the following

import matplotx
import matplotlib.pyplot as plt
plt.styles.use(matplotx.styles.dufte)

can be shortened to

import matplotlib.pyplot as plt
plt.styles.use("matplotx.dufte")

For all the examples above, I assume that .mplstyle sheets are in the package root directory but according to the style sheet docs, putting the style sheets at e.g. matplotx.styles.aura would work too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant