Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
5821a24
API: rename draw_no_output to draw_without_rendering
tacaswell Aug 28, 2021
1a9f0a2
DOC: re-word the whats new entry
tacaswell Aug 28, 2021
5a58788
Support sketch_params in pgf backend
takimata Jun 25, 2021
f67e604
Fix docstring
takimata Jun 25, 2021
92e9fb6
Add test
takimata Jun 30, 2021
c2ef020
Clarify stuff
takimata Jul 1, 2021
9d73118
Fix rendering of code block
takimata Jul 23, 2021
b94b282
Automatically load PGF components
takimata Jul 23, 2021
18c06c3
Scale params to match existing appearance
takimata Aug 22, 2021
a9377cd
Use descriptive names
takimata Aug 24, 2021
c3503a2
Fix comment length
takimata Aug 25, 2021
3263061
Merge pull request #20944 from anntzer/mtd
QuLogic Aug 30, 2021
124ba6e
DOC: re-word whats new
tacaswell Aug 31, 2021
6d56592
Merge pull request #20931 from tacaswell/api_rename_draw_no_output
timhoffm Aug 31, 2021
ceb794c
Merge pull request #20956 from anntzer/lhu
timhoffm Sep 1, 2021
b5058a5
Merge pull request #20955 from anntzer/glh
timhoffm Sep 1, 2021
bb12efe
Merge pull request #20952 from dstansby/3rd-party-redirect
QuLogic Sep 1, 2021
6683517
Merge pull request #20957 from anntzer/lhm
dstansby Sep 1, 2021
a142369
Merge pull request #20745 from QuLogic/event-docs
dstansby Sep 1, 2021
f023115
Small cleanups to math_to_image.
anntzer Sep 1, 2021
486ad06
BUG: Fix f_back is None handling
larsoner Sep 1, 2021
0b724bf
Add a GTK4 backend.
QuLogic Jul 31, 2021
139a4db
Move common GTK Backend code into a separate file.
QuLogic Aug 4, 2021
e135227
Combine common GTK timer code.
QuLogic Aug 4, 2021
1d6fd65
Combine common GTK toolbar code.
QuLogic Aug 5, 2021
68b4ee3
Clean up calls to Gtk.Window.set_icon_from_file.
QuLogic Aug 5, 2021
7b63dee
Add GTK4 to docs.
QuLogic Aug 6, 2021
d3804c2
Fix Ctrl+C out of IPython on GTK4.
QuLogic Aug 19, 2021
72f7595
Merge pull request #19553 from greglucas/norm-updater
tacaswell Sep 1, 2021
2e31b07
Merge pull request #20965 from larsoner/fback
QuLogic Sep 1, 2021
0a9007c
Merge pull request #20961 from anntzer/mti
dstansby Sep 1, 2021
d3da54a
Merge pull request #20321 from QuLogic/gtk4
QuLogic Sep 1, 2021
3eeae5b
Build wheels for Apple Silicon.
QuLogic Sep 2, 2021
fafe155
Merge pull request #20970 from QuLogic/m1-wheel
story645 Sep 2, 2021
640f96d
Cleanup some dviread docstrings.
anntzer Sep 2, 2021
3d7c92c
Docstring cleanups.
anntzer Sep 2, 2021
a1c69dd
Rename symbol_name to glyph_name where appropriate.
anntzer Sep 2, 2021
039c94a
Merge pull request #20973 from anntzer/d401
story645 Sep 2, 2021
75710ed
Clarify support for 2D coordinate inputs to streamplot.
anntzer Sep 2, 2021
8e400d8
Merge pull request #20975 from anntzer/s2d
timhoffm Sep 2, 2021
2a1075b
Merge pull request #20972 from anntzer/dd
timhoffm Sep 2, 2021
4e21dcf
Merge pull request #20942 from timhoffm/doc-axes-capitalization
timhoffm Sep 2, 2021
5656d11
Merge pull request #20974 from anntzer/gn
QuLogic Sep 2, 2021
f23fd1f
Make HandlerLine2D{,Compound} inherit constructors from HandlerNpoints.
anntzer Sep 3, 2021
a6221ed
Merge pull request #20986 from anntzer/lhhl
story645 Sep 3, 2021
f41edb6
FIX: colorbar with boundary norm, proportional, extend
jklymak Sep 4, 2021
6134061
Remove unused icon_filename, window_icon globals.
anntzer Sep 4, 2021
4dd72b9
Deprecate some backend_gtk3 helper globals.
anntzer Sep 4, 2021
72c728c
Fix ToolManager + TextBox support.
anntzer Sep 4, 2021
3361895
Merge pull request #20997 from anntzer/tmtb
timhoffm Sep 4, 2021
8ce14fb
Merge pull request #20987 from jklymak/fix-colorbar-boundary-extend
timhoffm Sep 5, 2021
1586fb5
Remove now-unused rcParams _deprecated entries.
anntzer Sep 6, 2021
f7622b6
Test the rcParams deprecation machinery.
anntzer Sep 6, 2021
162f688
Deemphasize mpl_toolkits in API docs.
anntzer Sep 5, 2021
481da9b
Separate tick and spine examples
dstansby Sep 7, 2021
cb17118
Merge pull request #21003 from anntzer/dtk
timhoffm Sep 7, 2021
79a29b6
Use numpydoc for GridSpecFromSubplotSpec.__init__
dstansby Sep 7, 2021
c4412e7
Merge pull request #21004 from anntzer/da
QuLogic Sep 7, 2021
7f89450
Merge pull request #20995 from anntzer/g3i
QuLogic Sep 7, 2021
d37075f
Merge pull request #21012 from dstansby/GridSpecFromSubplotSpec-doc
QuLogic Sep 7, 2021
8f62645
Merge pull request #20994 from anntzer/g4i
QuLogic Sep 7, 2021
308d2ac
Avoid TransformedBbox where unneeded.
anntzer Sep 7, 2018
3d7a46e
Merge pull request #20976 from dstansby/tick-spine-exs
timhoffm Sep 8, 2021
961a92c
Reword custom_ticker1 example.
anntzer Sep 8, 2021
39c5302
Merge pull request #21019 from anntzer/ct1
jklymak Sep 8, 2021
87bae58
Merge pull request #21010 from anntzer/ntb
dstansby Sep 8, 2021
971d110
Merge pull request #21005 from anntzer/rdmt
jklymak Sep 8, 2021
ce9a7b1
Merge pull request #20518 from takimata/pgf_sketch_path
tacaswell Sep 8, 2021
2d2cbe0
DOC: re-arrange user's guide and index
tacaswell Aug 15, 2021
8d8674c
DOC: add direct Matplotlib sponsorship to sponsor button
tacaswell Aug 20, 2021
ccf6270
DOC: split the user-guide into parts
tacaswell Aug 20, 2021
6339e69
DOC: add search bar back to inner index
tacaswell Aug 22, 2021
6598304
ENH: require sphinx-panels to build the docs
tacaswell Aug 22, 2021
0e00c50
DOC: add release notes to top bar
tacaswell Aug 22, 2021
6a91938
DOC: move installation out of top bar and onto inner index
tacaswell Aug 22, 2021
a1c2d0d
DOC: try to make the left sidebar on inner index better
tacaswell Aug 22, 2021
81002d0
DOC: put documentation types in a 2x2 grid
tacaswell Aug 22, 2021
8eb0192
DOC: rename user's guide -> user guide
tacaswell Aug 22, 2021
0d62f09
DOC: move detailed installation to user guide
tacaswell Aug 22, 2021
3839c5b
DOC: suggestions from review
tacaswell Aug 24, 2021
1c77a1b
STY: flake8 in conf.py
tacaswell Aug 24, 2021
f779ea6
STY: fix section capitalization
tacaswell Aug 24, 2021
50d41c5
DOC: continue to shuffle things around to placate the TOC
tacaswell Aug 24, 2021
769b3b7
DOC: add link to contents to index page
tacaswell Aug 24, 2021
2d599a8
DOC: tweaks to content / layout of inner index
tacaswell Aug 24, 2021
887be7b
DOC: add note about wheels
tacaswell Aug 24, 2021
965ef4d
DOC: hide the next/prev buttons
tacaswell Aug 24, 2021
4a892b7
DOC: add (but do not enable) external link to third-party page
tacaswell Aug 24, 2021
6d6ce6b
DOC: re-arrange contents.rst and top navbar
tacaswell Sep 4, 2021
daffe46
DOC: push up sphinx-pydata-theme dependency
tacaswell Sep 4, 2021
399fe22
DOC: re-arrange the release notes toctrees
tacaswell Aug 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions doc/users/next_whats_new/fig_draw_no_output.rst

This file was deleted.

12 changes: 12 additions & 0 deletions doc/users/next_whats_new/fig_draw_without_rendering.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Figure now has ``draw_without_rendering`` method
------------------------------------------------

Some aspects of a figure are only determined at draw-time, such as the exact
position of text artists or deferred computation like automatic data limits.
If you need these values, you can use ``figure.canvas.draw()`` to force a full
draw. However, this has side effects, sometimes requires an open file, and is
doing more work than is needed.

The new `.Figure.draw_without_rendering` method runs all the updates that
``draw()`` does, but skips rendering the figure. It's thus more efficient if you
need the updated values to configure further aspects of the figure.
2 changes: 1 addition & 1 deletion lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,7 @@ def _draw(renderer): raise Done(renderer)
def _no_output_draw(figure):
# _no_output_draw was promoted to the figure level, but
# keep this here in case someone was calling it...
figure.draw_no_output()
figure.draw_without_rendering()


def _is_non_interactive_terminal_ipython(ip):
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2793,7 +2793,7 @@ def print_pdf(self, filename, *,
file.close()

def draw(self):
self.figure.draw_no_output()
self.figure.draw_without_rendering()
return super().draw()


Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ def get_renderer(self):
return RendererPgf(self.figure, None)

def draw(self):
self.figure.draw_no_output()
self.figure.draw_without_rendering()
return super().draw()


Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ def _print_figure_tex(
_move_path_to_path_or_stream(tmpfile, outfile)

def draw(self):
self.figure.draw_no_output()
self.figure.draw_without_rendering()
return super().draw()


Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ def get_default_filetype(self):
return 'svg'

def draw(self):
self.figure.draw_no_output()
self.figure.draw_without_rendering()
return super().draw()


Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2808,7 +2808,7 @@ def draw(self, renderer):

self.canvas.draw_event(renderer)

def draw_no_output(self):
def draw_without_rendering(self):
"""
Draw the figure with no output. Useful to get the final size of
artists that require a draw before their size is known (e.g. text).
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4793,7 +4793,7 @@ def test_reset_ticks(fig_test, fig_ref):
labelsize=14, labelcolor='C1', labelrotation=45,
grid_color='C2', grid_alpha=0.8, grid_linewidth=3,
grid_linestyle='--')
fig.draw_no_output()
fig.draw_without_rendering()

# After we've changed any setting on ticks, reset_ticks will mean
# re-creating them from scratch. This *should* appear the same as not
Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/tests/test_colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def test_mappable_2d_alpha():
# the original alpha array
assert cb.alpha is None
assert pc.get_alpha() is x
fig.draw_no_output()
fig.draw_without_rendering()


def test_colorbar_label():
Expand Down Expand Up @@ -766,7 +766,7 @@ def test_inset_colorbar_layout():
cax = ax.inset_axes([1.02, 0.1, 0.03, 0.8])
cb = fig.colorbar(pc, cax=cax)

fig.draw_no_output()
fig.draw_without_rendering()
# make sure this is in the figure. In the colorbar swapping
# it was being dropped from the list of children...
np.testing.assert_allclose(cb.ax.get_position().bounds,
Expand Down Expand Up @@ -806,7 +806,7 @@ def test_aspects():
pc = ax[mm, nn].pcolormesh(np.arange(100).reshape(10, 10))
cb[nn][mm] = fig.colorbar(pc, ax=ax[mm, nn], orientation=orient,
aspect=aspect, extend=extend)
fig.draw_no_output()
fig.draw_without_rendering()
# check the extends are right ratio:
np.testing.assert_almost_equal(cb[0][1].ax.get_position().height,
cb[0][0].ax.get_position().height * 0.9,
Expand Down
32 changes: 16 additions & 16 deletions lib/matplotlib/tests/test_constrainedlayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def test_constrained_layout7():
for gs in gsl:
fig.add_subplot(gs)
# need to trigger a draw to get warning
fig.draw_no_output()
fig.draw_without_rendering()


@image_comparison(['constrained_layout8.png'])
Expand Down Expand Up @@ -309,7 +309,7 @@ def test_constrained_layout18():
ax2 = ax.twinx()
example_plot(ax)
example_plot(ax2, fontsize=24)
fig.draw_no_output()
fig.draw_without_rendering()
assert all(ax.get_position().extents == ax2.get_position().extents)


Expand All @@ -321,7 +321,7 @@ def test_constrained_layout19():
example_plot(ax2, fontsize=24)
ax2.set_title('')
ax.set_title('')
fig.draw_no_output()
fig.draw_without_rendering()
assert all(ax.get_position().extents == ax2.get_position().extents)


Expand All @@ -341,11 +341,11 @@ def test_constrained_layout21():
fig, ax = plt.subplots(constrained_layout=True)

fig.suptitle("Suptitle0")
fig.draw_no_output()
fig.draw_without_rendering()
extents0 = np.copy(ax.get_position().extents)

fig.suptitle("Suptitle1")
fig.draw_no_output()
fig.draw_without_rendering()
extents1 = np.copy(ax.get_position().extents)

np.testing.assert_allclose(extents0, extents1)
Expand All @@ -355,11 +355,11 @@ def test_constrained_layout22():
"""#11035: suptitle should not be include in CL if manually positioned"""
fig, ax = plt.subplots(constrained_layout=True)

fig.draw_no_output()
fig.draw_without_rendering()
extents0 = np.copy(ax.get_position().extents)

fig.suptitle("Suptitle", y=0.5)
fig.draw_no_output()
fig.draw_without_rendering()
extents1 = np.copy(ax.get_position().extents)

np.testing.assert_allclose(extents0, extents1)
Expand Down Expand Up @@ -407,7 +407,7 @@ def test_hidden_axes():
# (as does a gridspec slot that is empty)
fig, axs = plt.subplots(2, 2, constrained_layout=True)
axs[0, 1].set_visible(False)
fig.draw_no_output()
fig.draw_without_rendering()
extents1 = np.copy(axs[0, 0].get_position().extents)

np.testing.assert_allclose(
Expand All @@ -433,7 +433,7 @@ def test_colorbar_align():
fig.set_constrained_layout_pads(w_pad=4 / 72, h_pad=4 / 72, hspace=0.1,
wspace=0.1)

fig.draw_no_output()
fig.draw_without_rendering()
if location in ['left', 'right']:
np.testing.assert_allclose(cbs[0].ax.get_position().x0,
cbs[2].ax.get_position().x0)
Expand Down Expand Up @@ -475,15 +475,15 @@ def test_colorbars_no_overlapH():
def test_manually_set_position():
fig, axs = plt.subplots(1, 2, constrained_layout=True)
axs[0].set_position([0.2, 0.2, 0.3, 0.3])
fig.draw_no_output()
fig.draw_without_rendering()
pp = axs[0].get_position()
np.testing.assert_allclose(pp, [[0.2, 0.2], [0.5, 0.5]])

fig, axs = plt.subplots(1, 2, constrained_layout=True)
axs[0].set_position([0.2, 0.2, 0.3, 0.3])
pc = axs[0].pcolormesh(np.random.rand(20, 20))
fig.colorbar(pc, ax=axs[0])
fig.draw_no_output()
fig.draw_without_rendering()
pp = axs[0].get_position()
np.testing.assert_allclose(pp, [[0.2, 0.2], [0.44, 0.5]])

Expand Down Expand Up @@ -528,7 +528,7 @@ def test_align_labels():

fig.align_ylabels(axs=(ax3, ax1, ax2))

fig.draw_no_output()
fig.draw_without_rendering()
after_align = [ax1.yaxis.label.get_window_extent(),
ax2.yaxis.label.get_window_extent(),
ax3.yaxis.label.get_window_extent()]
Expand All @@ -541,22 +541,22 @@ def test_align_labels():

def test_suplabels():
fig, ax = plt.subplots(constrained_layout=True)
fig.draw_no_output()
fig.draw_without_rendering()
pos0 = ax.get_tightbbox(fig.canvas.get_renderer())
fig.supxlabel('Boo')
fig.supylabel('Booy')
fig.draw_no_output()
fig.draw_without_rendering()
pos = ax.get_tightbbox(fig.canvas.get_renderer())
assert pos.y0 > pos0.y0 + 10.0
assert pos.x0 > pos0.x0 + 10.0

fig, ax = plt.subplots(constrained_layout=True)
fig.draw_no_output()
fig.draw_without_rendering()
pos0 = ax.get_tightbbox(fig.canvas.get_renderer())
# check that specifying x (y) doesn't ruin the layout
fig.supxlabel('Boo', x=0.5)
fig.supylabel('Boo', y=0.5)
fig.draw_no_output()
fig.draw_without_rendering()
pos = ax.get_tightbbox(fig.canvas.get_renderer())
assert pos.y0 > pos0.y0 + 10.0
assert pos.x0 > pos0.x0 + 10.0
4 changes: 2 additions & 2 deletions lib/matplotlib/tests/test_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_date_empty():
# http://sourceforge.net/tracker/?func=detail&aid=2850075&group_id=80706&atid=560720
fig, ax = plt.subplots()
ax.xaxis_date()
fig.draw_no_output()
fig.draw_without_rendering()
np.testing.assert_allclose(ax.get_xlim(),
[mdates.date2num(np.datetime64('2000-01-01')),
mdates.date2num(np.datetime64('2010-01-01'))])
Expand All @@ -85,7 +85,7 @@ def test_date_empty():
mdates.set_epoch('0000-12-31')
fig, ax = plt.subplots()
ax.xaxis_date()
fig.draw_no_output()
fig.draw_without_rendering()
np.testing.assert_allclose(ax.get_xlim(),
[mdates.date2num(np.datetime64('2000-01-01')),
mdates.date2num(np.datetime64('2010-01-01'))])
Expand Down
8 changes: 4 additions & 4 deletions lib/matplotlib/tests/test_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,11 @@ def test_autofmt_xdate(which):
@mpl.style.context('default')
def test_change_dpi():
fig = plt.figure(figsize=(4, 4))
fig.draw_no_output()
fig.draw_without_rendering()
assert fig.canvas.renderer.height == 400
assert fig.canvas.renderer.width == 400
fig.dpi = 50
fig.draw_no_output()
fig.draw_without_rendering()
assert fig.canvas.renderer.height == 200
assert fig.canvas.renderer.width == 200

Expand Down Expand Up @@ -1082,10 +1082,10 @@ def test_subfigure_ticks():
ax3 = subfig_bl.add_subplot(gs[0, 3:14], sharey=ax1)

fig.set_dpi(120)
fig.draw_no_output()
fig.draw_without_rendering()
ticks120 = ax2.get_xticks()
fig.set_dpi(300)
fig.draw_no_output()
fig.draw_without_rendering()
ticks300 = ax2.get_xticks()
np.testing.assert_allclose(ticks120, ticks300)

Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/tests/test_mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def test_default_math_fontfamily():
prop2 = text2.get_fontproperties()
assert prop2.get_math_fontfamily() == 'cm'

fig.draw_no_output()
fig.draw_without_rendering()


def test_argument_order():
Expand All @@ -427,7 +427,7 @@ def test_argument_order():
prop4 = text4.get_fontproperties()
assert prop4.get_math_fontfamily() == 'dejavusans'

fig.draw_no_output()
fig.draw_without_rendering()


def test_mathtext_cmr10_minus_sign():
Expand Down
12 changes: 6 additions & 6 deletions lib/matplotlib/tests/test_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,38 +226,38 @@ def test_empty_default_limits(quantity_converter):
munits.registry[Quantity] = quantity_converter
fig, ax1 = plt.subplots()
ax1.xaxis.update_units(Quantity([10], "miles"))
fig.draw_no_output()
fig.draw_without_rendering()
assert ax1.get_xlim() == (0, 100)
ax1.yaxis.update_units(Quantity([10], "miles"))
fig.draw_no_output()
fig.draw_without_rendering()
assert ax1.get_ylim() == (0, 100)

fig, ax = plt.subplots()
ax.axhline(30)
ax.plot(Quantity(np.arange(0, 3), "miles"),
Quantity(np.arange(0, 6, 2), "feet"))
fig.draw_no_output()
fig.draw_without_rendering()
assert ax.get_xlim() == (0, 2)
assert ax.get_ylim() == (0, 30)

fig, ax = plt.subplots()
ax.axvline(30)
ax.plot(Quantity(np.arange(0, 3), "miles"),
Quantity(np.arange(0, 6, 2), "feet"))
fig.draw_no_output()
fig.draw_without_rendering()
assert ax.get_xlim() == (0, 30)
assert ax.get_ylim() == (0, 4)

fig, ax = plt.subplots()
ax.xaxis.update_units(Quantity([10], "miles"))
ax.axhline(30)
fig.draw_no_output()
fig.draw_without_rendering()
assert ax.get_xlim() == (0, 100)
assert ax.get_ylim() == (28.5, 31.5)

fig, ax = plt.subplots()
ax.yaxis.update_units(Quantity([10], "miles"))
ax.axvline(30)
fig.draw_no_output()
fig.draw_without_rendering()
assert ax.get_ylim() == (0, 100)
assert ax.get_xlim() == (28.5, 31.5)