-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add xkcd style file. #14943
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
Open
anntzer
wants to merge
2
commits into
matplotlib:main
Choose a base branch
from
anntzer:xkcdstyle
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+157
−168
Open
Add xkcd style file. #14943
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
xkcd style | ||
`````````` | ||
|
||
The xkcd style previously available as `.pyplot.xkcd` is now also available as | ||
a regular style file, which can be used as ``matplotlib.style.use("xkcd")``. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"figure.facecolor": "white", | ||
"text.color": "0.15", | ||
"axes.labelcolor": "0.15", | ||
"legend.frameon": False, | ||
"legend.numpoints": 1, | ||
"legend.scatterpoints": 1, | ||
"xtick.direction": "out", | ||
"ytick.direction": "out", | ||
"xtick.color": "0.15", | ||
"ytick.color": "0.15", | ||
"axes.axisbelow": True, | ||
"image.cmap": "Greys", | ||
"font.family": "sans-serif", | ||
"font.sans-serif": [ | ||
"Arial", "Liberation Sans", "DejaVu Sans", "Bitstream Vera Sans", | ||
"sans-serif", | ||
], | ||
"grid.linestyle": "-", | ||
"lines.solid_capstyle": "round" | ||
} |
30 changes: 0 additions & 30 deletions
30
lib/matplotlib/mpl-data/stylelib/seaborn-v0_8-dark.mplstyle
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import ast | ||
from pathlib import Path | ||
|
||
|
||
__mpl_style__ = { | ||
**ast.literal_eval(Path(__file__).with_name("_seaborn-v0_8-common.py").read_text()), | ||
"axes.grid": False, | ||
"axes.facecolor": "#EAEAF2", | ||
"axes.edgecolor": "white", | ||
"axes.linewidth": 0, | ||
"grid.color": "white", | ||
"xtick.major.size": 0, | ||
"ytick.major.size": 0, | ||
"xtick.minor.size": 0, | ||
"ytick.minor.size": 0, | ||
} |
30 changes: 0 additions & 30 deletions
30
lib/matplotlib/mpl-data/stylelib/seaborn-v0_8-darkgrid.mplstyle
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import ast | ||
from pathlib import Path | ||
|
||
|
||
__mpl_style__ = { | ||
**ast.literal_eval(Path(__file__).with_name("_seaborn-v0_8-common.py").read_text()), | ||
"axes.grid": True, | ||
"axes.facecolor": "#EAEAF2", | ||
"axes.edgecolor": "white", | ||
"axes.linewidth": 0, | ||
"grid.color": "white", | ||
"xtick.major.size": 0, | ||
"ytick.major.size": 0, | ||
"xtick.minor.size": 0, | ||
"ytick.minor.size": 0, | ||
} |
30 changes: 0 additions & 30 deletions
30
lib/matplotlib/mpl-data/stylelib/seaborn-v0_8-ticks.mplstyle
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import ast | ||
from pathlib import Path | ||
|
||
|
||
__mpl_style__ = { | ||
**ast.literal_eval(Path(__file__).with_name("_seaborn-v0_8-common.py").read_text()), | ||
"axes.grid": False, | ||
"axes.facecolor": "white", | ||
"axes.edgecolor": ".15", | ||
"axes.linewidth": 1.25, | ||
"grid.color": ".8", | ||
"xtick.major.size": 6, | ||
"ytick.major.size": 6, | ||
"xtick.minor.size": 3, | ||
"ytick.minor.size": 3, | ||
} |
30 changes: 0 additions & 30 deletions
30
lib/matplotlib/mpl-data/stylelib/seaborn-v0_8-white.mplstyle
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
import ast | ||
from pathlib import Path | ||
|
||
|
||
__mpl_style__ = { | ||
**ast.literal_eval(Path(__file__).with_name("_seaborn-v0_8-common.py").read_text()), | ||
"axes.grid": False, | ||
"axes.facecolor": "white", | ||
"axes.edgecolor": ".15", | ||
"axes.linewidth": 1.25, | ||
"grid.color": ".8", | ||
"xtick.major.size": 0, | ||
"ytick.major.size": 0, | ||
"xtick.minor.size": 0, | ||
"ytick.minor.size": 0, | ||
} |
30 changes: 0 additions & 30 deletions
30
lib/matplotlib/mpl-data/stylelib/seaborn-v0_8-whitegrid.mplstyle
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
lib/matplotlib/mpl-data/stylelib/seaborn-v0_8-whitegrid.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import ast | ||
from pathlib import Path | ||
|
||
|
||
__mpl_style__ = { | ||
**ast.literal_eval(Path(__file__).with_name("_seaborn-v0_8-common.py").read_text()), | ||
"axes.grid": True, | ||
"axes.facecolor": "white", | ||
"axes.edgecolor": ".8", | ||
"axes.linewidth": 1, | ||
"grid.color": ".8", | ||
"xtick.major.size": 0, | ||
"ytick.major.size": 0, | ||
"xtick.minor.size": 0, | ||
"ytick.minor.size": 0, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from matplotlib import patheffects | ||
|
||
|
||
__mpl_style__ = { | ||
"axes.edgecolor": "black", | ||
"axes.grid": False, | ||
"axes.linewidth": 1.5, | ||
"axes.unicode_minus": False, | ||
"figure.facecolor": "white", | ||
"font.family": ["xkcd", "Humor Sans", "Comic Sans MS"], | ||
"font.size": 14.0, | ||
"grid.linewidth": 0.0, | ||
"lines.linewidth": 2.0, | ||
"path.effects": [patheffects.withStroke(linewidth=4, foreground="w")], | ||
"path.sketch": (1, 100, 2), | ||
"text.usetex": False, | ||
"xtick.major.size": 8, | ||
"xtick.major.width": 3, | ||
"ytick.major.size": 8, | ||
"ytick.major.width": 3, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I'm dreading about python style files: Hard-to-follow dynamically defined contents.
IMHO we should use algorithmic code structures very sparingly in style files. There's great value in a declarative definition.
Furthermore, I assume that that this is done to prevent repetition and enforce consistency (DRY). However, style files are static (in fact the only time we have changed these ever was renaming them once). So, getting accidentally inconsistent is not a practical problem.
Let's just keep the pattern from the .mplstyle file of writing everything out and marking the common and individual parts by comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not just make the common file normal Python and import it, instead of replicating all that with our own evaluation stuff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite clear what you mean.
*.mplstyle
files.py
based style file. We can freely decide on the structure, but__mpl_style__ = {...}
seems a reasonable choice - and since it is internal we can still make adjustments.My concrete suggestion here is to not touch the seaborn .mplstyle files in this PR. It should only introduce
stylelib\xkcd.py
and the machinery to handle that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, if we want to change seaborn's styles, then instead of this
ast.literal_eval
work, it'd be simpler to give it an importable name, and do something like:But again, that's only if we want to change these files with inheritance in this manner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using imports is tricky because style files currently live in mpl-data and thus not directly importable without playing tricks with the import machinery, which seems to be too complex to be worth it.
If the general agreement is to not change the seaborn styles at all I can just revert that part of the change.