diff --git a/modules/util/plot.py b/modules/util/plot.py index 319980a7063374f3ec8286bd37f4a5671b9db5ee..2d63910203f53f4df13c5b3b9636402f8f35246f 100644 --- a/modules/util/plot.py +++ b/modules/util/plot.py @@ -1,10 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -""" -Created on Wed May 22 13:58:09 2019 -@author: Wimmers -""" from sklearn.metrics import roc_auc_score, roc_curve import tensorflow as tf @@ -18,6 +14,7 @@ import h5py from util.util import get_grid_values_all, get_cartopy_crs, homedir from util.setup import home_dir +import mpl_scatter_density logdir = home_dir+'/tf_logs' root_imgdir = home_dir @@ -289,7 +286,19 @@ def make_time_domain_hist(values, edges): fig, ax = plt.subplots(1, 1) ax.hist(values, bins=edges, ec='black') - #ax.xaxis.set_major_locator(mdates.MonthLocator()) - #ax.xaxis.set_major_formatter(mdates.DateFormatter('%y-%m-%d_%h')) - #fig.autofmt_xdate() + # ax.xaxis.set_major_locator(mdates.MonthLocator()) + # ax.xaxis.set_major_formatter(mdates.DateFormatter('%y-%m-%d_%h')) + # fig.autofmt_xdate() plt.show() + + +def scatter_density(x, y, color, fname=None, fig=None): + if fig is None: + fig = plt.figure() + ax = fig.add_subplot(1, 1, 1, projection='scatter_density') + ax.scatter_density(x, y, color=color) + + if fname is not None: + fig.savefig(fname) + + return fig \ No newline at end of file