Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from echedey-ls/master
Modify installation and exposing of .mplstyles
- Loading branch information
Showing
27 changed files
with
229 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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 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,19 @@ | ||
from os import listdir | ||
from os.path import isdir, join | ||
|
||
import matplotlib.pyplot as plt | ||
|
||
import pkg_resources | ||
|
||
# register the included stylesheet in the matplotlib style library | ||
# TODO: migrate to importlib_resources when possible | ||
data_path = pkg_resources.resource_filename('scienceplots', 'styles/') | ||
stylesheets = plt.style.core.read_style_directory(data_path) # Reads styles in /styles | ||
# Reads styles in /styles subfolders | ||
for inode in listdir(data_path): | ||
new_data_path = join(data_path, inode) | ||
if isdir(new_data_path): | ||
new_stylesheets = plt.style.core.read_style_directory(new_data_path) | ||
stylesheets.update(new_stylesheets) | ||
# Update dictionary of styles | ||
plt.style.core.update_nested_dict(plt.style.library, stylesheets) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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 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