Skip to content

Commit f2ec3dd

Browse files
committed
corrections in driver_plot_portraitplot.py and EnsoPlotTemplate.py
1 parent 82896d0 commit f2ec3dd

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

lib/version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
__version__ = 'v1.0-2020'
2-
__git_tag_describe__ = 'v1.0-2020'
3-
__git_sha1__ = 'f5d69bef7abdd11f5cc984b34e702cbdb498e486'
2+
__git_tag_describe__ = 'v1.0-2020-2-g82896d0'
3+
__git_sha1__ = '82896d0cb96585c87ca144a1515465eaf08dd874'

plots/EnsoPlotTemplate.py

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,16 +1851,18 @@ def plot_metrics_correlations(tab_rval, figure_name, xy_names, tab_pval=None, wr
18511851
for ll, txt in enumerate(xlabel):
18521852
cc = "yellowgreen" if txt in met_o1 else ("plum" if txt in met_o2 else
18531853
("gold" if txt in met_o3 else "turquoise"))
1854-
boxdict = dict(lw=0, facecolor=cc, pad=3, alpha=1) if chigh is True else dict()
18551854
weight = "bold" if txt in bold_names else "normal"
1856-
ax.text(ll + 0.5, -0.3, met_names[txt], fontsize=18, ha="right", va="top", rotation=45, color="k",
1857-
weight=weight, bbox=boxdict)
1858-
ax.text(-0.4, ll + 0.5, met_names[txt], fontsize=18, ha="right", va="center", color="k", weight=weight,
1859-
bbox=boxdict)
1855+
if chigh is True:
1856+
boxdict = dict(lw=0, facecolor=cc, pad=1, alpha=1)
1857+
ax.text(ll + 0.5, -0.2, met_names[txt], fontsize=18, ha="right", va="top", rotation=45, color="k",
1858+
weight=weight, bbox=boxdict)
1859+
ax.text(-0.4, ll + 0.5, met_names[txt], fontsize=18, ha="right", va="center", color="k", weight=weight,
1860+
bbox=boxdict)
1861+
else:
1862+
ax.text(ll + 0.5, -0.2, met_names[txt], fontsize=18, ha="right", va="top", rotation=45, color="k",
1863+
weight=weight)
1864+
ax.text(-0.4, ll + 0.5, met_names[txt], fontsize=18, ha="right", va="center", color="k", weight=weight)
18601865
if cfram is True:
1861-
lic = ["k"] * 6 + ["yellowgreen"] * 4 + ["plum"] * 4 + ["gold"] * 4 + ["turquoise"] * 4
1862-
lis = ["-"] * len(lic)
1863-
liw = [4] * 6 + [10] * (len(lic) - 6)
18641866
tmp1 = [txt for ll, txt in enumerate(xlabel) if txt in met_o1]
18651867
n1 = len(tmp1)
18661868
tmp2 = [txt for ll, txt in enumerate(xlabel) if txt in met_o2]
@@ -1883,6 +1885,8 @@ def plot_metrics_correlations(tab_rval, figure_name, xy_names, tab_pval=None, wr
18831885
lic += ["turquoise"] * 4
18841886
nc += 2
18851887
lic = ["k"] * nc + lic
1888+
lis = ["-"] * len(lic)
1889+
liw = [4] * nc + [10] * (len(lic) - nc)
18861890
# horizontal and vertical black lines
18871891
lix, liy = list(), list()
18881892
if len(tmp1) > 0:
@@ -1894,7 +1898,7 @@ def plot_metrics_correlations(tab_rval, figure_name, xy_names, tab_pval=None, wr
18941898
if len(tmp3) > 0:
18951899
lix += [[n3, n3], [0, n4]]
18961900
liy += [[0, n4], [n3, n3]]
1897-
if len(tmp1) > 0:
1901+
if len(tmp4) > 0:
18981902
lix += [[n1, n1], [0, n4]]
18991903
liy += [[0, n4], [n1, n1]]
19001904
# horizontal and vertical colored frame
@@ -2066,9 +2070,12 @@ def plot_portraitplot(tab, figure_name, xticklabel=[], yticklabel=[], title=[],
20662070
for ll, txt in enumerate(xticklabel[kk]):
20672071
cc = "yellowgreen" if txt in met_o1 else ("plum" if txt in met_o2 else
20682072
("gold" if txt in met_o3 else "turquoise"))
2069-
boxdict = dict(lw=0, facecolor=cc, pad=3, alpha=1) if chigh is True else dict()
2070-
ax.text(ll + 0.5, -0.3, met_names[txt], fontsize=18, ha="right", va="top", rotation=45, color="k",
2071-
bbox=boxdict)
2073+
if chigh is True:
2074+
boxdict = dict(lw=0, facecolor=cc, pad=1, alpha=1)
2075+
ax.text(ll + 0.5, -0.2, met_names[txt], fontsize=18, ha="right", va="top", rotation=45, color="k",
2076+
bbox=boxdict)
2077+
else:
2078+
ax.text(ll + 0.5, -0.2, met_names[txt], fontsize=18, ha="right", va="top", rotation=45, color="k")
20722079
if cfram is True:
20732080
tmp1 = [met_o1, met_o2, met_o3, met_o4]
20742081
# draw vertical black lines to separate metric types
@@ -2226,10 +2233,12 @@ def plot_projects_comparison(tab_val, figure_name, title="", x_name="", y_name="
22262233
for ll, txt in enumerate(xticklabel):
22272234
cc = "yellowgreen" if txt in met_o1 else ("plum" if txt in met_o2 else
22282235
("gold" if txt in met_o3 else "turquoise"))
2229-
boxdict = dict(lw=0, facecolor=cc, pad=3, alpha=1) if chigh is True else dict()
2230-
weight = "bold" if txt in bold_names else "normal"
2231-
ax.text(ll + 0.5, -0.05, met_names[txt], fontsize=18, ha="right", va="top", rotation=45, color="k",
2232-
weight=weight, bbox=boxdict)
2236+
if chigh is True:
2237+
boxdict = dict(lw=0, facecolor=cc, pad=1, alpha=1)
2238+
ax.text(ll + 0.5, -0.03, met_names[txt], fontsize=18, ha="right", va="top", rotation=45, color="k",
2239+
bbox=boxdict)
2240+
else:
2241+
ax.text(ll + 0.5, -0.03, met_names[txt], fontsize=18, ha="right", va="top", rotation=45, color="k")
22332242
else:
22342243
ax.set_xticklabels(axis)
22352244
if cfram is True:

scripts/driver_plot_portraitplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
except: pass
112112
else: my_metrics += list(dict_met[mod].keys())
113113
my_metrics = sort_metrics(sorted(list(set(my_metrics)), key=lambda v: v.upper()))
114-
my_models = sort_models(tmp_models)
114+
my_models = list(reversed(sort_models(tmp_models)))
115115
# read other observational datasets compared to the reference
116116
dict_ref_met = get_metric_values_observations(dict_json["obs2obs"][mc], list_observations, my_metrics, mc)
117117
# number of line to add to the array (CMIP mean, reference, other observational datasets,...)

0 commit comments

Comments
 (0)