本文整理汇总了Python中matplotlib.backends.backend_webagg_core.FigureManagerWebAgg类的典型用法代码示例。如果您正苦于以下问题:Python FigureManagerWebAgg类的具体用法?Python FigureManagerWebAgg怎么用?Python FigureManagerWebAgg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FigureManagerWebAgg类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, canvas, num):
FigureManagerWebAgg.__init__(self, canvas, num)
toolitems = []
for name, tooltip, image, method in self.ToolbarCls.toolitems:
if name is None:
toolitems.append(['', '', '', ''])
else:
toolitems.append([name, tooltip, image, method])
canvas._toolbar_items = toolitems
self.web_sockets = [self.canvas]
示例2: __init__
def __init__(self):
super(MyApplication, self).__init__([
# Static files for the CSS and JS
(r'/_static/(.*)',
#(r'/(.*)',
tornado.web.StaticFileHandler,
{'path': FigureManagerWebAgg.get_static_file_path()}),
(r'/', MainPage),
# The pages that contain the plot (or maybe the plots)
(r'/DataFrame\d', PlotPage),
(r'/mpl.js', self.MplJs),
# Sends images and events to the browser, and receives
# events from the browser
(r'/([0-9]+)/ws', self.WebSocket),
# Handles the downloading (i.e., saving) of static images
(r'/download.([a-z0-9.]+)', self.Download),
],
static_path='static',
template_path='templates',
debug=True
)
示例3: __init__
def __init__(self, stop_callback=None):
super(MyApplication, self).__init__([
# Static files for the CSS and JS
(r'/_static/(.*)',
tornado.web.StaticFileHandler,
{'path': FigureManagerWebAgg.get_static_file_path()}),
# The page that contains all of the pieces
('/', self.MainPage),
('/mpl.js', self.MplJs),
# Sends images and events to the browser, and receives
# events from the browser
('/ws', self.WebSocket),
# Handles the downloading (i.e., saving) of static images
(r'/download.([a-z0-9.]+)', self.Download),
])
figure = Figure()
self.manager = new_figure_manager_given_figure(
id(figure), figure)
ax = figure.add_subplot(1, 1, 1)
def callback(event):
'''Sends event to front end'''
event.info.pop('caller', None) # HACK: popping caller b/c it's not JSONizable.
self.manager._send_event(event.type, **event.info)
self.fc_manager = fc_widget.FCGateManager(ax, callback_list=callback)
self.stop_callback = stop_callback
示例4: create_application
def create_application():
application = Application([
('/_static/(.*)', StaticFileHandler, {'path': FigureManagerWebAgg.get_static_file_path()}),
('/mpl.js', MplJavaScriptHandler),
(url_pattern('/mpl/download/{{base_dir}}/{{figure_id}}/{{format_name}}'), MplDownloadHandler),
(url_pattern('/mpl/figures/{{base_dir}}/{{figure_id}}'), MplWebSocketHandler),
(url_pattern('/'), WebAPIVersionHandler),
(url_pattern('/exit'), WebAPIExitHandler),
(url_pattern('/api'), JsonRpcWebSocketHandler, dict(
service_factory=service_factory,
validation_exception_class=ValidationError,
report_defer_period=WEBAPI_PROGRESS_DEFER_PERIOD)
),
(url_pattern('/ws/res/plot/{{base_dir}}/{{res_name}}'), ResourcePlotHandler),
(url_pattern('/ws/res/geojson/{{base_dir}}/{{res_id}}'), ResFeatureCollectionHandler),
(url_pattern('/ws/res/geojson/{{base_dir}}/{{res_id}}/{{feature_index}}'), ResFeatureHandler),
(url_pattern('/ws/res/csv/{{base_dir}}/{{res_id}}'), ResVarCsvHandler),
(url_pattern('/ws/res/html/{{base_dir}}/{{res_id}}'), ResVarHtmlHandler),
(url_pattern('/ws/res/tile/{{base_dir}}/{{res_id}}/{{z}}/{{y}}/{{x}}.png'), ResVarTileHandler),
(url_pattern('/ws/ne2/tile/{{z}}/{{y}}/{{x}}.jpg'), NE2Handler),
(url_pattern('/ws/countries'), CountriesGeoJSONHandler),
])
application.workspace_manager = FSWorkspaceManager()
return application
示例5: __init__
def __init__(self, routes, **kwargs):
# routes common to all webagg servers
mplweb_routes = [
(r'/([0-9]+)/download.([a-z0-9.]+)', DownloadHandler),
(r'/([0-9a-f]+)/([0-9]+)/ws', WebSocketHandler),
(r'/mpl.js', MplJsHandler),
(r'/_static/(.*)', tornado.web.StaticFileHandler,
dict(path=FigureManagerWebAgg.get_static_file_path())),
]
tornado.web.Application.__init__(self, routes + mplweb_routes, **kwargs)
self.prog_states = {} # uid -> ProgramState
self.fig_managers = {} # fignum -> manager
# hack in a mock manager for keep-alive sockets
self.fig_managers['0'] = _MockFigureManager()
示例6: __init__
def __init__(self, figure):
self.figure = figure
self.manager = new_figure_manager_given_figure(id(figure), figure)
super().__init__([
# Static files for the CSS and JS
(r'/_static/(.*)',
tornado.web.StaticFileHandler,
{'path': FigureManagerWebAgg.get_static_file_path()}),
# The page that contains all of the pieces
('/', self.MainPage),
('/mpl.js', self.MplJs),
# Sends images and events to the browser, and receives
# events from the browser
('/ws', self.WebSocket),
# Handles the downloading (i.e., saving) of static images
(r'/download.([a-z0-9.]+)', self.Download),
])
示例7: __init__
def __init__(self, canvas, num):
self._shown = False
FigureManagerWebAgg.__init__(self, canvas, num)
示例8: get
def get(self):
self.set_header('Content-Type', 'application/javascript')
js_content = FigureManagerWebAgg.get_javascript()
with open('static/mpl.js', 'r') as fh:
local_content = fh.read()
self.write(local_content)
示例9: get
def get(self):
self.set_header('Content-Type', 'application/javascript')
js_content = FigureManagerWebAgg.get_javascript()
self.write(js_content)