Skip to content

Commit

Permalink
matplotlib 3.10 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
cmbant committed Feb 21, 2025
1 parent 3f4297e commit 9003a66
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions getdist/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,10 +1130,12 @@ def clean_args(_args):
kwargs['alpha'] = alpha
cs = ax.contour(density.x, density.y, z, sorted(contour_levels), colors=cols, linestyles=linestyles,
linewidths=lws, **clean_args(kwargs))
dashes = args.get('dashes')
if dashes:
for c in cs.collections:
c.set_dashes([(0, dashes)])
if dashes := args.get('dashes'):
if hasattr(cs, 'collections'):
for c in cs.collections:
c.set_dashes([(0, dashes)])
else: # matplotlib 3.8+
cs.set_dashes([(0, dashes)] * len(cs.levels))
if proxy_ix >= 0:
line = matplotlib.lines.Line2D([0, 1], [0, 1], ls=linestyles[0], lw=lws, color=cols[0],
alpha=args.get('alpha'))
Expand Down

0 comments on commit 9003a66

Please sign in to comment.