Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 6, 2022
1 parent e686101 commit e4cc6a0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyscriptjs/src/python/pyscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@
os.environ["MPLBACKEND"] = "AGG"

import matplotlib.pyplot

_old_show = matplotlib.pyplot.show
assert _old_show, "matplotlib.pyplot.show"


def show(*, block=None):
buf = io.BytesIO()
matplotlib.pyplot.savefig(buf, format="png")
buf.seek(0)
display(matplotlib.pyplot)
matplotlib.pyplot.clf()


matplotlib.pyplot.show = show

loop = asyncio.get_event_loop()
Expand All @@ -46,7 +49,7 @@ def show(*, block=None):
"_repr_json_": "application/json",
"_repr_javascript_": "application/javascript",
"savefig": "image/png",
"show": "image/png"
"show": "image/png",
}


Expand Down

0 comments on commit e4cc6a0

Please sign in to comment.