Skip to content

Commit d53dd09

Browse files
authored
Merge pull request #97 from lukelbd/preprocessor-improvements
Preprocessor improvements
2 parents d2d388c + d95337f commit d53dd09

File tree

3 files changed

+205
-163
lines changed

3 files changed

+205
-163
lines changed

proplot/axes.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ def colorbar(self, *args, loc=None, pad=None,
979979
height_ratios=((1 - length) / 2, length, (1 - length) / 2),
980980
)
981981
subplotspec = gridspec[1]
982-
with self.figure._unlock():
982+
with self.figure._authorize_add_subplot():
983983
ax = self.figure.add_subplot(subplotspec, projection=None)
984984
if ax is self:
985985
raise ValueError(f'Uh oh.')
@@ -1190,8 +1190,9 @@ def draw(self, renderer=None, *args, **kwargs):
11901190
def get_size_inches(self):
11911191
"""Returns the width and the height of the axes in inches."""
11921192
width, height = self.figure.get_size_inches()
1193-
width = width * abs(self.get_position().width)
1194-
height = height * abs(self.get_position().height)
1193+
bbox = self.get_position()
1194+
width = width * abs(bbox.width)
1195+
height = height * abs(bbox.height)
11951196
return width, height
11961197

11971198
def get_tightbbox(self, renderer, *args, **kwargs):
@@ -2537,7 +2538,7 @@ def altx(self):
25372538
# See https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes/_subplots.py # noqa
25382539
if self._altx_child or self._altx_parent:
25392540
raise RuntimeError('No more than *two* twin axes are allowed.')
2540-
with self.figure._unlock():
2541+
with self.figure._authorize_add_subplot():
25412542
ax = self._make_twin_axes(sharey=self, projection='xy')
25422543
ax.set_autoscaley_on(self.get_autoscaley_on())
25432544
ax.grid(False)
@@ -2552,7 +2553,7 @@ def altx(self):
25522553
def alty(self):
25532554
if self._alty_child or self._alty_parent:
25542555
raise RuntimeError('No more than *two* twin axes are allowed.')
2555-
with self.figure._unlock():
2556+
with self.figure._authorize_add_subplot():
25562557
ax = self._make_twin_axes(sharex=self, projection='xy')
25572558
ax.set_autoscalex_on(self.get_autoscalex_on())
25582559
ax.grid(False)

proplot/rctools.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -953,8 +953,14 @@ def ipython_matplotlib(backend=None, fmt=None):
953953
Parameters
954954
----------
955955
backend : str, optional
956-
The backend name. Use ``'auto'`` to apply ``%matplotlib inline`` for
957-
notebooks and ``%matplotlib qt`` for all other sessions.
956+
The backend name. The default is ``'auto'``, which applies
957+
``%matplotlib inline`` for notebooks and ``%matplotlib qt`` for
958+
all other sessions.
959+
960+
Note that when using the qt backend on macOS, you may want to prevent
961+
"tabbed" figure windows by navigating to Settings...Dock and changing
962+
"Prefer tabs when opening documents" to "Manually" (see \
963+
`Issue #13164 <https://github.com/matplotlib/matplotlib/issues/13164>`__).
958964
fmt : str or list of str, optional
959965
The inline backend file format(s). Valid formats include ``'jpg'``,
960966
``'png'``, ``'svg'``, ``'pdf'``, and ``'retina'``. This is ignored
@@ -996,8 +1002,9 @@ def ipython_matplotlib(backend=None, fmt=None):
9961002
ipython.magic(f'config InlineBackend.figure_formats = {fmt!r}')
9971003
ipython.magic('config InlineBackend.rc = {}') # no notebook overrides
9981004
ipython.magic('config InlineBackend.close_figures = True') # memory issues
999-
ipython.magic( # use proplot tight layout
1000-
'config InlineBackend.print_figure_kwargs = {"bbox_inches":None}')
1005+
ipython.magic( # use ProPlot tight layout instead
1006+
'config InlineBackend.print_figure_kwargs = {"bbox_inches":None}'
1007+
)
10011008

10021009

10031010
def ipython_autoreload(autoreload=None):

0 commit comments

Comments
 (0)