MCPcopy
hub / github.com/AutoViML/AutoViz / save_image_data

Function save_image_data

autoviz/AutoViz_Utils.py:60–82  ·  view source on GitHub ↗
(fig, chart_format, plot_name, mk_dir, additional='')

Source from the content-addressed store, hash-verified

58
59######## This is where we store the image data in a dictionary with a list of images #########
60def save_image_data(fig, chart_format, plot_name, mk_dir, additional=''):
61 if not os.path.isdir(mk_dir):
62 os.mkdir(mk_dir)
63 if additional == '':
64 filename = os.path.join(mk_dir, plot_name + "." + chart_format)
65 else:
66 filename = os.path.join(mk_dir, plot_name + additional + "." + chart_format)
67 ##################################################################################
68 if chart_format == 'svg':
69 ###### You have to add these lines to each function that creates charts currently ##
70 imgdata = io.StringIO()
71 fig.savefig(filename, dpi='figure', format=chart_format)
72 imgdata.seek(0)
73 svg_data = imgdata.getvalue()
74 return svg_data
75 else:
76 ### You have to do it slightly differently for PNG and JPEG formats
77 imgdata = BytesIO()
78 fig.savefig(filename, format=chart_format, dpi='figure')
79 # fig.savefig(imgdata, format=chart_format, bbox_inches='tight', pad_inches=0.0)
80 imgdata.seek(0)
81 figdata_png = base64.b64encode(imgdata.getvalue())
82 return figdata_png
83
84
85#### This module analyzes a dependent Variable and finds out whether it is a

Callers 11

draw_word_cloudsFunction · 0.85
draw_pivot_tablesFunction · 0.85
draw_pivot_tables_oldFunction · 0.85
draw_scattersFunction · 0.85
draw_pair_scattersFunction · 0.85
draw_barplotsFunction · 0.85
draw_heatmapFunction · 0.85
draw_distplotFunction · 0.85
draw_violinplotFunction · 0.85
draw_date_varsFunction · 0.85
draw_catscatterplotsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected