Skip to content

Commit

Permalink
Convert matplotlib relative font size to absolute fontsize when used …
Browse files Browse the repository at this point in the history
…with pygmt/Cartopy
  • Loading branch information
Mark Wieczorek committed Sep 18, 2020
1 parent d97ce0c commit ef3cf54
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
32 changes: 24 additions & 8 deletions pyshtools/shclasses/shgrid.py
Expand Up @@ -1193,14 +1193,22 @@ def plot(self, projection=None, tick_interval=[30, 30], ticks='WSen',
minor_tick_interval = [None, None]
if axes_labelsize is None:
axes_labelsize = _mpl.rcParams['axes.labelsize']
if axes_labelsize == 'medium':
axes_labelsize = _mpl.rcParams['font.size']
if type(axes_labelsize) == str:
axes_labelsize = _mpl.font_manager \
.FontProperties(size=axes_labelsize) \
.get_size_in_points()
if tick_labelsize is None:
tick_labelsize = _mpl.rcParams['xtick.labelsize']
if tick_labelsize == 'medium':
tick_labelsize = _mpl.rcParams['font.size']
if type(tick_labelsize) == str:
tick_labelsize = _mpl.font_manager \
.FontProperties(size=tick_labelsize) \
.get_size_in_points()
if titlesize is None:
titlesize = _mpl.rcParams['axes.titlesize']
if type(titlesize) == str:
titlesize = _mpl.font_manager \
.FontProperties(size=titlesize) \
.get_size_in_points()
if self.kind == 'complex' and title is None:
title = ['Real component', 'Imaginary component']
if xlabel is True:
Expand Down Expand Up @@ -1428,14 +1436,22 @@ def plotgmt(self, fig=None, projection='mollweide', region='g',
.format(repr(colorbar)))
if axes_labelsize is None:
axes_labelsize = _mpl.rcParams['axes.labelsize']
if axes_labelsize == 'medium':
axes_labelsize = _mpl.rcParams['font.size']
if type(axes_labelsize) == str:
axes_labelsize = _mpl.font_manager \
.FontProperties(size=axes_labelsize) \
.get_size_in_points()
if tick_labelsize is None:
tick_labelsize = _mpl.rcParams['xtick.labelsize']
if tick_labelsize == 'medium':
tick_labelsize = _mpl.rcParams['font.size']
if type(tick_labelsize) == str:
tick_labelsize = _mpl.font_manager \
.FontProperties(size=tick_labelsize) \
.get_size_in_points()
if titlesize is None:
titlesize = _mpl.rcParams['axes.titlesize']
if type(titlesize) == str:
titlesize = _mpl.font_manager \
.FontProperties(size=titlesize) \
.get_size_in_points()

figure = self._plot_pygmt(
fig=fig, projection=projection, region=region, width=width,
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Expand Up @@ -8,3 +8,4 @@ six
shapely
cartopy>=0.18.0
pygmt>=0.2
flake8

0 comments on commit ef3cf54

Please sign in to comment.