Skip to content

Commit fa43396

Browse files
authored
removed shading when less than 3 forecasts (#247)
fixes issue #214 Co-authored-by: William Savran <[email protected]>
1 parent 8fbdd95 commit fa43396

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

csep/utils/plots.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,9 +1758,9 @@ def plot_comparison_test(results_t, results_w=None, axes=None, plot_args=None):
17581758
markerfacecolor=facecolor, markeredgecolor=color,
17591759
markersize=markersize)
17601760

1761+
ax.set_xticks(numpy.arange(len(results_t)))
17611762
ax.set_xticklabels([res.sim_name[0] for res in results_t],
17621763
rotation=xticklabels_rotation, fontsize=xlabel_fontsize)
1763-
ax.set_xticks(numpy.arange(len(results_t)))
17641764
ax.set_xlabel(xlabel)
17651765
ax.set_ylabel(ylabel, fontsize=ylabel_fontsize)
17661766
ax.set_title(title)
@@ -1769,8 +1769,9 @@ def plot_comparison_test(results_t, results_w=None, axes=None, plot_args=None):
17691769
ax.yaxis.set_major_locator(matplotlib.ticker.MaxNLocator(integer=True))
17701770
ax.set_ylim([ylim[0], ylim[1]])
17711771
ax.set_xlim([-0.5, len(results_t) - 0.5])
1772-
ax.bar(xTickPos, numpy.array([9999] * len(xTickPos)), bottom=-2000,
1773-
width=(xTickPos[1] - xTickPos[0]), color=['gray', 'w'], alpha=0.2)
1772+
if len(results_t) > 2:
1773+
ax.bar(xTickPos, numpy.array([9999] * len(xTickPos)), bottom=-2000,
1774+
width=(xTickPos[1] - xTickPos[0]), color=['gray', 'w'], alpha=0.2)
17741775
fig.tight_layout()
17751776

17761777
return ax

0 commit comments

Comments
 (0)