Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG : patch from mikofski to fix webagg example #3205

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/user_interfaces/embedding_webagg.py
Expand Up @@ -20,7 +20,7 @@
import tornado.websocket


from matplotlib.backends.backend_webagg_core import (
from backend_webagg_core import (
FigureManagerWebAgg, new_figure_manager_given_figure)
from matplotlib.figure import Figure

Expand Down
16 changes: 14 additions & 2 deletions lib/matplotlib/backends/backend_webagg_core.py
Expand Up @@ -26,7 +26,7 @@
from matplotlib.figure import Figure
from matplotlib import backend_bases
from matplotlib import _png

from matplotlib import rcParams

def new_figure_manager(num, *args, **kwargs):
"""
Expand Down Expand Up @@ -65,6 +65,18 @@ def __init__(self, *args, **kwargs):
# sent to the clients will be a full frame.
self._force_full = True

@classmethod
def get_supported_filetypes_grouped(cls):
"""Return a dict of savefig file formats supported by this backend,
where the keys are a file type name, such as 'Joint Photographic
Experts Group', and the values are a list of filename extensions used
for that filetype, such as ['jpg', 'jpeg']."""
groupings = {}
for ext, name in cls.filetypes.iteritems():
groupings.setdefault(name, []).append(ext)
groupings[name].sort()
return groupings

def show(self):
# show the figure window
from matplotlib.pyplot import show
Expand Down Expand Up @@ -362,7 +374,7 @@ def get_javascript(cls, stream=None):
json.dumps(extensions)))

output.write("mpl.default_extension = {0};".format(
json.dumps(FigureCanvasWebAggCore.get_default_filetype())))
json.dumps(rcParams['savefig.format'])))

if stream is None:
return output.getvalue()
Expand Down