Skip to content

Commit

Permalink
removed shading when less than 3 forecasts
Browse files Browse the repository at this point in the history
fixes issue #214
  • Loading branch information
wsavran committed Nov 20, 2023
1 parent 8fbdd95 commit ee37e91
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions csep/utils/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -1758,9 +1758,9 @@ def plot_comparison_test(results_t, results_w=None, axes=None, plot_args=None):
markerfacecolor=facecolor, markeredgecolor=color,
markersize=markersize)

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

return ax
Expand Down

0 comments on commit ee37e91

Please sign in to comment.