Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2e0a090

Browse files
committed
Remove format dropdown since png is the only format working
1 parent 60dc749 commit 2e0a090

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

lib/matplotlib/backends/web_backend/nbagg_mpl.js

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ mpl.mpl_figure_comm = function(comm, msg) {
3131
var ws_proxy = comm_websocket_adapter(comm)
3232

3333
function ondownload(figure, format) {
34-
var canvasData = figure.canvas.toDataURL("image/" + format);
35-
window.open(canvasData);
34+
window.open(figure.imageObj.src);
3635
}
3736

3837
var fig = new mpl.figure(id, ws_proxy,
@@ -113,21 +112,6 @@ mpl.figure.prototype._init_toolbar = function() {
113112
nav_element.append(button);
114113
}
115114

116-
var fmt_picker_span = $('<span/>');
117-
118-
var fmt_picker = $('<select width="75" style="width: 75px; margin-top: 10px"</select>');
119-
fmt_picker.addClass('mpl-toolbar-optionui-widget ui-widget-content');
120-
fmt_picker_span.append(fmt_picker);
121-
nav_element.append(fmt_picker_span);
122-
this.format_dropdown = fmt_picker[0];
123-
124-
for (var ind in mpl.extensions) {
125-
var fmt = mpl.extensions[ind];
126-
var option = $(
127-
'<option/>', {selected: fmt === mpl.default_extension}).html(fmt);
128-
fmt_picker.append(option)
129-
}
130-
131115
// Add the status bar.
132116
var status_bar = $('<span class="mpl-message" style="text-align:right; float: right;"/>');
133117
nav_element.append(status_bar);
@@ -143,6 +127,10 @@ mpl.figure.prototype._init_toolbar = function() {
143127
titlebar.prepend(buttongrp);
144128
}
145129

130+
mpl.figure.prototype.handle_save = function(fig, msg) {
131+
fig.ondownload(fig, null);
132+
}
133+
146134
mpl.find_output_cell = function(html_output) {
147135
// Return the cell and output element which can be found *uniquely* in the notebook.
148136
// Note - this is a bit hacky, but it is done because the "notebook_saving.Notebook"

0 commit comments

Comments
 (0)