ENH: use canvas renderer in draw#19765
Conversation
91e97fa to
3f7d454
Compare
|
I am 👎 on this. Every artist has a We already have |
|
What is the user-facing way to force a draw on a figure if not |
|
|
|
I think the interplay between a figure and its canvas is pretty obscure to most people, including me apparently. I still think a discoverable way to trigger a draw is preferable, but don't feel super strongly about it. |
|
Actually I'll re-open. We do need to tell users to trigger draws, and having to send them to something that is undocumented is not great. I think that trumps aesthetics as to whether figure is a special artist or not. As for other artists, I'd be fine if we wanted them to get their canvas and use that as a default in all these routines... |
|
Without having looked into the details and without claiming to understand the internal mechanics: |
|
I believe that a problem is that |
|
Hmm, we have What I am suggesting here is to change I agree this is all confusing, but my confusion is that I don't understand all the other needs to call |
|
There's (i) |
|
Thanks, that all sounds right. Unfortunately and only the last I will still maintain that it is unintuitive that just to get the proper position of elements on the canvas we have to reach down and force a draw on the canvas |
Mid-script you have not given the Qt event loop a chance to run (see https://matplotlib.org/stable/users/interactive_guide.html#scripts-and-functions).
yes. To make matters worse there is also I agree it is confusing that almost everything is named In 3.4 we made sure that I think what we should do instead is to promote matplotlib/lib/matplotlib/backend_bases.py Lines 1587 to 1590 in c81f58d mpl.make_internal_state_consistent(fig) or fig.resolve_deferred_computations ?
|
|
I think that would be great plus or minus the name. |
|
Fig.no_output_draw doesn't seem so bad to me, or draw_no_output. |
As a frequent user of constrained_layout, I have been saving figures to a with io.BytesIO() as temp_io_buffer:
fig.savefig(temp_io_buffer)so replacing all that with a |
|
So I think the consensus here is:
"no_output_draw" is a bit miss leading because the "output" of What I think the name needs to communicate that this:
|
|
I'm just a simple fellow, with minimal knowledge of the backends, but that sounds a lot like drawing with "no output" to the screen or file system. I don't think "no output" conveys nothing happens. |
|
Replaced by #19967 |
|
But that's also closed? |
|
Ooops, #19968 replaces that. I was trying a new GitHub workflow, and obviously didn't understand what it was doing! |
PR Summary
I'm not sure why we required the renderer to be passed to
fig.draw, but suggest we allow it to be a kwarg and default tofig.canvas.get_renderer()PR Checklist
pytestpasses).flake8on changed files to check).flake8-docstringsand runflake8 --docstring-convention=all).doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).