Commit d27ff46b authored by Artem Pulkin's avatar Artem Pulkin

presentation: add a separate `replace` option to plot_diagonal

parent 70b45b76
Pipeline #43958 passed with stage
in 2 minutes and 26 seconds
......@@ -256,7 +256,7 @@ def plot_convergence(y=None, append=True, ax=None, xlabel="Step", ylabel="Error"
y : tuple, list, np.ndarray, float, None
Error values.
append : bool
If True and `plot_handles` is set, appends convergence data.
If True and `ax` is set, appends convergence data.
ax : Axes
`matplotlib` axes to plot on.
xlabel : str
......@@ -339,7 +339,7 @@ def plot_convergence(y=None, append=True, ax=None, xlabel="Step", ylabel="Error"
return ax
def plot_diagonal(reference, prediction, ax=None, xlabel="Reference", ylabel="Prediction", nmax=None, **kwargs):
def plot_diagonal(reference, prediction, replace=False, ax=None, xlabel="Reference", ylabel="Prediction", nmax=None, **kwargs):
"""
Diagonal plot "reference" vs "data".
......@@ -349,6 +349,9 @@ def plot_diagonal(reference, prediction, ax=None, xlabel="Reference", ylabel="Pr
Reference values.
prediction : np.ndarray
Predicted values.
replace : bool
If True and `ax` set, attempts to find previous data
on the plot and to re-plot it.
ax : Axes
`matplotlib` axes to plot on.
xlabel : str
......@@ -386,8 +389,9 @@ def plot_diagonal(reference, prediction, ax=None, xlabel="Reference", ylabel="Pr
reference = reference[ind]
prediction = prediction[ind]
if ax is None:
ax = pyplot.gca()
if ax is None or not replace:
if ax is None:
ax = pyplot.gca()
ax.plot(reference, prediction, **_kwargs)
ax.plot(diag, diag, color="black", zorder=10)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment