Every line of 'plt.savefig blank' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
36 def savefig(save_as): 37 """Save the figure.""" 38 plt.savefig(f"../figures/Fig1_{save_as}.pdf", dpi=600, bbox_inches='tight')
925 def savefig(title): 926 # today = datetime.now().strftime('%Y-%m-%d') 927 928 # Lowercase, replace special chars with whitespace, join on whitespace. 929 cleantitle = '-'.join(re.sub('[^a-z0-9]+', ' ', title.lower()).split()) 930 931 fname = cleantitle 932 fpath_cmd = fname + '.command' 933 934 log.info('Writing command to %s', fpath_cmd) 935 command = poor_mans_cmdline() 936 with open(fpath_cmd, 'w') as f: 937 f.write(command) 938 939 log.info('Writing figure as PNG to %s', fname + '.png') 940 plt.savefig(fname + '.png', dpi=200)
1425 def save_figure( 1426 figure, save_at="", name="fig", save_fmts=["png"], output=False, **kwargs 1427 ): 1428 """ 1429 Save a figure at a specified location in a number of formats. 1430 """ 1431 default_config = dict(dpi=600, bbox_inches="tight", transparent=True) 1432 config = default_config.copy() 1433 config.update(kwargs) 1434 for fmt in save_fmts: 1435 out_filename = os.path.join(str(save_at), name + "." + fmt) 1436 if output: 1437 logger.info("Saving " + out_filename) 1438 figure.savefig(out_filename, format=fmt, **config)
49 def save_on_disk(plot): 50 plot.savefig("image.png")
94 def save_figure(filename, extra_artists=None, tight=True): 95 filename = filename.replace('.', '-') 96 filename += '.pdf' 97 if extra_artists: 98 plt.savefig( 99 FIGURES_DIR + filename, 100 bbox_extra_artists=extra_artists, 101 bbox_inches='tight') 102 else: 103 if tight: 104 plt.tight_layout() 105 plt.savefig(FIGURES_DIR + filename)