MCPcopy Index your code
hub / github.com/RolnickLab/climart / height_plot

Function height_plot

climart/utils/plotting.py:164–182  ·  view source on GitHub ↗
(yaxis, line, std, yticks=None, ylabel=None, xlabel=None, show=False, fill_between=True)

Source from the content-addressed store, hash-verified

162
163
164def height_plot(yaxis, line, std, yticks=None, ylabel=None, xlabel=None, show=False, fill_between=True):
165 fig, ax = plt.subplots(1)
166 if "mbe" in xlabel.lower():
167 # to better see the bias
168 ax.plot(np.zeros(yaxis.shape), yaxis, '--', color='grey')
169
170 p = ax.plot(line, yaxis, '-', linewidth=3)
171 if fill_between:
172 ax.fill_betweenx(yaxis, line - std, line + std, alpha=0.2)
173 else:
174 ax.plot(line - std, yaxis, '--', color=p[0].get_color(), linewidth=1.5)
175 ax.plot(line + std, yaxis, '--', color=p[0].get_color(), linewidth=1.5)
176
177 xlim = [0, ax.get_xlim()[1]] if 'mae' in xlabel.lower() or 'rmse' in xlabel.lower() else None
178 set_labels_and_ticks(ax=ax, xlabel=xlabel, xlim=xlim,
179 yticks=yaxis, ytick_labels=yticks,
180 ylabel=ylabel, show=show)
181
182 return fig
183
184
185def level_errors(Y_true, Y_preds, epoch):

Callers 1

height_errorsFunction · 0.85

Calls 1

set_labels_and_ticksFunction · 0.85

Tested by

no test coverage detected