Skip to content

Commit

Permalink
Dedupe seaborn styles.
Browse files Browse the repository at this point in the history
  • Loading branch information
anntzer committed Jun 26, 2023
1 parent 47d2d92 commit 6a4d715
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 151 deletions.
21 changes: 21 additions & 0 deletions lib/matplotlib/mpl-data/stylelib/_seaborn-v0_8-common.py
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 lib/matplotlib/mpl-data/stylelib/seaborn-v0_8-dark.mplstyle

This file was deleted.

16 changes: 16 additions & 0 deletions lib/matplotlib/mpl-data/stylelib/seaborn-v0_8-dark.py
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 lib/matplotlib/mpl-data/stylelib/seaborn-v0_8-darkgrid.mplstyle

This file was deleted.

16 changes: 16 additions & 0 deletions lib/matplotlib/mpl-data/stylelib/seaborn-v0_8-darkgrid.py
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 lib/matplotlib/mpl-data/stylelib/seaborn-v0_8-ticks.mplstyle

This file was deleted.

16 changes: 16 additions & 0 deletions lib/matplotlib/mpl-data/stylelib/seaborn-v0_8-ticks.py
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 lib/matplotlib/mpl-data/stylelib/seaborn-v0_8-white.mplstyle

This file was deleted.

17 changes: 17 additions & 0 deletions lib/matplotlib/mpl-data/stylelib/seaborn-v0_8-white.py
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 lib/matplotlib/mpl-data/stylelib/seaborn-v0_8-whitegrid.mplstyle

This file was deleted.

16 changes: 16 additions & 0 deletions lib/matplotlib/mpl-data/stylelib/seaborn-v0_8-whitegrid.py
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,
}
4 changes: 3 additions & 1 deletion lib/matplotlib/style/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,14 @@ def _read_pystyle_base_directory():
used internally to load files provided by Matplotlib itself, not
user-provided style files.
A Python style is a Python module that exports a dict named
A Python style is a non-private Python module that exports a dict named
``__mpl_style__``, from which a `RcParams` is constructed. This convention
may be revisited if this feature ever becomes public.
"""
styles = {}
for path in Path(BASE_LIBRARY_PATH).glob("*.py"):
if path.name.startswith("_"):
continue
spec = importlib.util.spec_from_file_location(path.stem, path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
Expand Down

0 comments on commit 6a4d715

Please sign in to comment.