Skip to content

Commit 1c7d517

Browse files
committed
removed download_notebook_image() function
1 parent bd46038 commit 1c7d517

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

plotly/offline/offline.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -609,50 +609,3 @@ def enable_mpl_offline(resize=False, strip_style=False,
609609
formatter.for_type(matplotlib.figure.Figure,
610610
lambda fig: iplot_mpl(fig, resize, strip_style, verbose,
611611
show_link, link_text, validate))
612-
613-
614-
def download_notebook_image(format='png', height=600, width=800,
615-
filename='plot_image'):
616-
"""
617-
Download an image of the most recent plot. This function should be
618-
called in a cell following the output cell that includes the plot.
619-
In other words, do not run this functon in the same cell as your
620-
iplot call.
621-
622-
Keyword arguments:
623-
format -- sets the image format for the saved file (default='png')
624-
Accepts formats include: .jpeg, .png, .svg, .webp
625-
height -- sets the height of the image in px (default=600)
626-
width -- sets the width of the image in px (default=800)
627-
filename -- the name of the saved file without format extension
628-
(default='plot_image')
629-
"""
630-
script = ('<script>'
631-
'function downloadimage(format, height, width,'
632-
' filename) {{'
633-
'var elementsList = document.querySelectorAll(\'.code_cell\');'
634-
'var new_list = new Array();'
635-
'for(var i=0; i < elementsList.length; i++) {{'
636-
'if(elementsList[i].classList.contains(\'selected\')) {{'
637-
'break;'
638-
'}};'
639-
'var temp = elementsList[i].getElementsByClassName'
640-
'(\'plot-container plotly\');'
641-
'if (temp.length > 0) {{'
642-
'new_list.push(elementsList[i].getElementsByClassName'
643-
'(\'plot-container plotly\')[0]);'
644-
'}}'
645-
'}}'
646-
'if (new_list.length>0) {{'
647-
'var pre_div = new_list.slice(-1)[0];'
648-
'var p = document.getElementById(pre_div.parentElement.id);'
649-
'Plotly.downloadImage(p, {{format: format, height: height, '
650-
'width: width, filename: filename}});'
651-
'}}'
652-
'}}'
653-
'downloadimage(\'{format}\', {height}, {width}, \'{filename}\');'
654-
'</script>'
655-
).format(format=format, height=height, width=width,
656-
filename=filename)
657-
658-
display(HTML(script))

0 commit comments

Comments
 (0)