Skip to content

Commit

Permalink
Improve resolution of sphinx-gallery figures
Browse files Browse the repository at this point in the history
  • Loading branch information
rhugonnet committed Oct 24, 2024
1 parent d504873 commit 4a45225
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
"backreferences_dir": "gen_modules/backreferences",
"doc_module": ("geoutils"), # Which function/class levels are used to create galleries
"remove_config_comments": True, # To remove comments such as sphinx-gallery-thumbnail-number (only works in code, not in text)
"reset_modules": ("matplotlib", "sphinxext.reset_mpl",),
# To reset matplotlib for each gallery (and run custom function that fixes the default DPI)
}

extlinks = {
Expand Down
7 changes: 7 additions & 0 deletions doc/source/sphinxext.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Functions for documentation configuration only, importable by sphinx"""
# To reset resolution setting for each sphinx-gallery example
def reset_mpl(gallery_conf, fname):
# To get a good resolution for displayed figures
from matplotlib import pyplot
pyplot.rcParams['figure.dpi'] = 600
pyplot.rcParams['savefig.dpi'] = 600

0 comments on commit 4a45225

Please sign in to comment.