Skip to content

Commit

Permalink
bigger fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
faizan90 committed Nov 21, 2019
1 parent f828331 commit abc84de
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 56 deletions.
3 changes: 3 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import matplotlib as mpl
mpl.rc('font', size=14)

from matplotlib import use as plt_use
import matplotlib.pyplot as plt
from pandas.plotting import register_matplotlib_converters
Expand Down
12 changes: 5 additions & 7 deletions core/compare_infill.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def _plot_comparison(
(nse, ln_nse, kge))
title_str += (('Pearson correlation: %0.2f, Spearman correlation: '
'%0.2f)') % (correl_pe, correl_sp))
plt.suptitle(title_str)
plt.suptitle(title_str, y=1.005)
infill_ax.set_xlim(self.infill_dates[0], self.infill_dates[-1])
plt.grid()
plt.legend(framealpha=0.5, loc=0)
Expand All @@ -148,14 +148,12 @@ def _plot_infill_vs_obs_cdf_time_sers(
plt.figure(figsize=(6, 5.5))
infill_ax = plt.subplot(111)

infill_ax.plot(
infill_ax.scatter(
infill_probs,
orig_probs,
alpha=alpha,
lw=lw,
ls='-',
marker='o',
ms=lw)
s=lw)

infill_ax.plot(
orig_probs,
Expand Down Expand Up @@ -286,7 +284,7 @@ def _plot_obs_vs_infill_dists(
(vals_wtn_rng, 100 * (1.0 - self.ks_alpha)))
title_str += (('\nOut of %d, %d values below and %d above '
'limits') % (n_vals, n_ks_fl_l, n_ks_fu_g))
plt.suptitle(title_str)
plt.suptitle(title_str, y=1.05)

_ = out_compar_plot_loc[:-(len(self.out_fig_fmt) + 1)]
out_freq_compare_loc = _ + '_obs_probs_cdf.' + self.out_fig_fmt
Expand Down Expand Up @@ -494,7 +492,7 @@ def plot_all(self, args):
out_add_info_df,
self.update_summary_df_only) = args

lw, alpha = 0.8, 0.7
lw, alpha = 1.4, 0.7

interp_data_idxs = logical_or(
isnan(act_var),
Expand Down
38 changes: 23 additions & 15 deletions ecops/plot_ecops.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def _plot_ecop(
ecop_raw_ax.set_xlim(0, 1)
ecop_raw_ax.set_ylim(0, 1)
ecop_raw_ax.grid()
ecop_raw_ax.set_title('Empirical Copula - Scatter')
ecop_raw_ax.set_title('Empirical Copula - Scatter', size=12)

# Empirical copula - gridded
cop_dict = bi_var_copula(prob_i, prob_j, self.cop_bins)
Expand Down Expand Up @@ -251,12 +251,16 @@ def _plot_ecop(

emp_title_str = ''
emp_title_str += 'Empirical copula - Gridded'
emp_title_str += ('\n(asymm_1: %1.1E, asymm_2: %1.1E)' %
(emp_asymm_1, emp_asymm_2))
emp_title_str += ('\n(asymm_1: %s, asymm_2: %s)' %
(asymm_1_str, asymm_2_str))

ecop_grid_ax.set_title(emp_title_str)
emp_title_str += (
'\n(asymm_1: %1.1E, asymm_2: %1.1E)' %
(emp_asymm_1, emp_asymm_2))

emp_title_str += (
'\n(asymm_1: %s, asymm_2: %s)' %
(asymm_1_str, asymm_2_str))

ecop_grid_ax.set_title(emp_title_str, size=12)

# Corresponding gaussian grid
# TODO: adjust for precipitation case i.e. 0 and 1 ppt
Expand All @@ -282,13 +286,16 @@ def _plot_ecop(

gau_title_str = ''
gau_title_str += 'Gaussian copula'
gau_title_str += (('\n(min asymm_1: %1.1E, '
'max asymm_1: %1.1E)') % (
min_asymm_1, max_asymm_1))
gau_title_str += (('\n(min asymm_2: %1.1E, '
'max asymm_2: %1.1E)') % (
min_asymm_2, max_asymm_2))
gau_cop_ax.set_title(gau_title_str)

gau_title_str += (
('\nasymm_1 (min, max): %1.1E, %1.1E') %
(min_asymm_1, max_asymm_1))

gau_title_str += (
('\nasymm_2 (min, max): %1.1E, %1.1E') %
(min_asymm_2, max_asymm_2))

gau_cop_ax.set_title(gau_title_str, size=12)

leg_ax.set_axis_off()
cb = plt.colorbar(_cb, cax=cax)
Expand All @@ -310,9 +317,10 @@ def _plot_ecop(
(prob_i.shape[0], correl, self.cop_bins))
title_str += ('\n(rho: %0.3f, tau: %0.3f, lag: %d)' % (
correl, tau, curr_lag))
plt.suptitle(title_str)

plt.subplots_adjust(hspace=0.15, wspace=1.5, top=0.75)
plt.suptitle(title_str, y=1.005)

plt.subplots_adjust(hspace=0.15, wspace=1.2, top=0.75)

out_ecop_fig_name = 'ecop_%s_vs_%s.%s' % (
infill_stn, other_stn, self.out_fig_fmt)
Expand Down
11 changes: 6 additions & 5 deletions misc/plot_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ def plot_stats(self):

self.stats_df = self.stats_df.apply(lambda x: to_numeric(x))

tick_font_size = 5
tick_font_size = 6
stats_arr = self.stats_df.values
n_stns = stats_arr.shape[0]
n_cols = stats_arr.shape[1]

_, stats_ax = plt.subplots(1,
1,
figsize=(0.45 * n_stns, 0.8 * n_cols))
_, stats_ax = plt.subplots(
1, 1, figsize=(0.45 * n_stns, 0.8 * n_cols))

stats_ax.matshow(stats_arr.T,
cmap=plt.get_cmap('Blues'),
vmin=0,
Expand All @@ -83,7 +83,8 @@ def plot_stats(self):
('%0.2f' % stats_arr[s[0], s[1]]).rstrip('0'),
va='center',
ha='center',
fontsize=tick_font_size)
fontsize=tick_font_size,
rotation=45)

stats_ax.set_xticks(list(range(0, n_stns)))
stats_ax.set_xticklabels(self.stats_df.index)
Expand Down
2 changes: 1 addition & 1 deletion misc/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def plot_summary(self):

clr_alpha = 0.4
n_segs = 100
font_size = 6
font_size = 8
max_columns_per_fig = 15

cmap_name = 'my_clr_list'
Expand Down
9 changes: 4 additions & 5 deletions nebors/nrst_nebs.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def _plot_nrst_stns(args):
out_nebor_plots_dir,
out_fig_dpi) = args

tick_font_size = 5
tick_font_size = 7
n_nebs = len(nebs)

nrst_stns_ax = plt.subplot(111)
Expand Down Expand Up @@ -316,15 +316,14 @@ def _plot_nrst_stns(args):

adjust_text(plt_texts, only_move={'points': 'y', 'text': 'y'})
nrst_stns_ax.grid()
nrst_stns_ax.set_xlabel('Eastings', size=tick_font_size)
nrst_stns_ax.set_ylabel('Northings', size=tick_font_size)
nrst_stns_ax.set_xlabel('Eastings')
nrst_stns_ax.set_ylabel('Northings')
nrst_stns_ax.legend(framealpha=0.5, loc=0)

nrst_stns_ax.set_xlim(0.995 * xs.min(), 1.005 * xs.max())
nrst_stns_ax.set_ylim(0.995 * ys.min(), 1.005 * ys.max())

plt.setp(nrst_stns_ax.get_xticklabels(), size=tick_font_size)
plt.setp(nrst_stns_ax.get_yticklabels(), size=tick_font_size)
plt.setp(nrst_stns_ax.get_xticklabels(), rotation=90)

plt.savefig(
os_join(out_nebor_plots_dir, '%s_neibor_stns.png' % infill_stn),
Expand Down
18 changes: 9 additions & 9 deletions nebors/rank_corr_nebs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from adjustText import adjust_text
from pandas import DataFrame, Series

# from .nrst_nebs import NrstStns
from ..misc.misc_ftns import (
get_norm_rand_symms, get_lag_ser, as_err, ret_mp_idxs)
from ..cyth import get_asymms_sample, get_corrcoeff
Expand Down Expand Up @@ -508,7 +507,7 @@ def _plot_hi_corr_stns(args):
out_fig_dpi,
lags) = args

tick_font_size = 5
tick_font_size = 7
n_nebs = len(nebs)

hi_corr_stns_ax = plt.subplot(111)
Expand Down Expand Up @@ -557,15 +556,14 @@ def _plot_hi_corr_stns(args):

adjust_text(plt_texts, only_move={'points': 'y', 'text': 'y'})
hi_corr_stns_ax.grid()
hi_corr_stns_ax.set_xlabel('Eastings', size=tick_font_size)
hi_corr_stns_ax.set_ylabel('Northings', size=tick_font_size)
hi_corr_stns_ax.set_xlabel('Eastings')
hi_corr_stns_ax.set_ylabel('Northings')
hi_corr_stns_ax.legend(framealpha=0.5, loc=0)

hi_corr_stns_ax.set_xlim(0.999 * xs.min(), 1.001 * xs.max())
hi_corr_stns_ax.set_ylim(0.999 * ys.min(), 1.001 * ys.max())

plt.setp(hi_corr_stns_ax.get_xticklabels(), size=tick_font_size)
plt.setp(hi_corr_stns_ax.get_yticklabels(), size=tick_font_size)
plt.setp(hi_corr_stns_ax.get_xticklabels(), rotation=90)

plt.savefig(
os_join(out_rank_corr_plots_dir,
Expand All @@ -588,7 +586,7 @@ def _plot_long_term_corr(args):
lags) = args

# TODO: have 15 stns at max on a row
tick_font_size = 6
tick_font_size = 8

corrs_ctr_ser[isnan(corrs_ctr_ser)] = 0

Expand All @@ -613,7 +611,8 @@ def _plot_long_term_corr(args):
int(lags[neb])),
va='center',
ha='center',
fontsize=tick_font_size)
fontsize=tick_font_size,
rotate=45)

else:
corrs_ax.text(
Expand All @@ -623,7 +622,8 @@ def _plot_long_term_corr(args):
corrs_ser[neb], int(corrs_ctr_ser[neb])),
va='center',
ha='center',
fontsize=tick_font_size)
fontsize=tick_font_size,
rotate=45)

corrs_ax.set_yticks([])
corrs_ax.set_yticklabels([])
Expand Down
14 changes: 0 additions & 14 deletions test/normcopula_infill_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,8 @@
# infill_cop.max_time_lag_corr = 1
# infill_cop.cut_cdf_thresh = 0.5

# _beg = timeit.default_timer()
# infill_cop.cmpt_plot_nrst_stns()
# _end = timeit.default_timer()
# _tot = (_end - _beg)
# print('Took %0.4f secs!' % _tot)
#
# time.sleep(10)
#
# _beg = timeit.default_timer()
# infill_cop.cmpt_plot_rank_corr_stns()
# _end = timeit.default_timer()
# _tot = (_end - _beg)
# print('Took %0.4f secs!' % _tot)
#
# time.sleep(10)

# infill_cop.plot_stats()
# infill_cop.plot_ecops()
infill_cop.infill()
Expand Down

0 comments on commit abc84de

Please sign in to comment.