Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

WIP: for non-interactive backends make fig.canvas.draw() force the render#16573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
pharshalp wants to merge2 commits intomatplotlib:masterfrompharshalp:non_interactive_draw
Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
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
2 changes: 2 additions & 0 deletionsazure-pipelines.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,8 @@
# Create and test a Python package on multiple Python versions.
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
pr: none
trigger: none

strategy:
matrix:
Expand Down
6 changes: 6 additions & 0 deletionslib/matplotlib/backends/backend_pgf.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -870,6 +870,12 @@ def _print_pgf_to_fh(self, fh, *,
writeln(fh, r"\makeatother")
writeln(fh, r"\endgroup")


def draw(self):
# docstring inherited
self.figure.draw(self.get_renderer())


def print_pgf(self, fname_or_fh, *args, **kwargs):
"""
Output pgf macros for drawing the figure so it can be included and
Expand Down
13 changes: 13 additions & 0 deletionslib/matplotlib/tests/test_backend_pgf.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -324,3 +324,16 @@ def test_bbox_inches_tight(tmpdir):
ax.imshow([[0, 1], [2, 3]])
fig.savefig(os.path.join(tmpdir, "test.pdf"), backend="pgf",
bbox_inches="tight")


@needs_pdflatex
@pytest.mark.style('default')
@pytest.mark.backend('pgf')
def test_draw():
mpl.rcParams['pgf.texsystem'] = 'pdflatex'
fig, ax = plt.subplots()
ax.plot(np.arange(10))
old_Nticks = len(ax.yaxis.majorTicks)
fig.canvas.draw()
new_Nticks = len(ax.yaxis.majorTicks)
assert old_Nticks != new_Nticks

[8]ページ先頭

©2009-2025 Movatter.jp