Skip to content

Commit

Permalink
fix zero contour issue
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstangl committed Jul 30, 2020
1 parent 12ca043 commit ea2fb13
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion flavio/plots/plotfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,8 @@ def contour(x, y, z, levels, z_min=None,
_contour_args.update(contour_args)
_contourf_args.update(contourf_args)
# for the filling, need to add zero contour
levelsf = [0] + list(levels)
zero_contour = min(np.min(z),np.min(levels)*(1-1e-16))
levelsf = [zero_contour] + list(levels)
ax = plt.gca()
if filled:
ax.contourf(x, y, z, levels=levelsf, **_contourf_args)
Expand Down

0 comments on commit ea2fb13

Please sign in to comment.