Skip to content

Commit

Permalink
Fix for #302
Browse files Browse the repository at this point in the history
  • Loading branch information
thouska committed Feb 27, 2023
1 parent 844abb7 commit a5028d8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/spotpy/analyser.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ def plot_posterior_parameter_histogram(ax, results, parameter):


def plot_parameter_uncertainty(
posterior_results, evaluation, fig_name="Posterior_parameter_uncertainty.png"
posterior_results, evaluation, maximize=True,
fig_name="Posterior_parameter_uncertainty.png"
):
import matplotlib.pyplot as plt

Expand All @@ -363,8 +364,10 @@ def plot_parameter_uncertainty(
label="parameter uncertainty",
)
ax.plot(evaluation, "r.", markersize=1, label="Observation data")

bestindex, bestobjf = get_maxlikeindex(posterior_results, verbose=False)
if maximize:
bestindex, bestobjf = get_maxlikeindex(posterior_results, verbose=False)
else:
bestindex, bestobjf = get_minlikeindex(posterior_results, verbose=False)
plt.plot(
list(posterior_results[simulation_fields][bestindex][0]),
"b-",
Expand Down

0 comments on commit a5028d8

Please sign in to comment.