Skip to content

Commit

Permalink
mask for unfilled contours
Browse files Browse the repository at this point in the history
  • Loading branch information
cmbant committed Jan 22, 2025
1 parent 147bbbc commit eaf73a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions getdist/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,7 @@ def add_2d_contours(self, root, param1=None, param2=None, plotno=0, of=None, col
def clean_args(_args):
return {k: v for k, v in _args.items() if k not in ('color', 'ls', 'lw')}

z = density.P if density.mask is None else np.ma.masked_where(density.mask, density.P)
if kwargs.get('filled'):
if cols is None:
color = kwargs.get('color')
Expand All @@ -1107,7 +1108,6 @@ def clean_args(_args):
else:
cols = color
levels = sorted(np.append([density.P.max() + 1], contour_levels))
z = density.P if density.mask is None else np.ma.masked_where(density.mask, density.P)
cs = ax.contourf(density.x, density.y, z, levels, colors=cols, alpha=alpha, **clean_args(kwargs))

fc = tuple(cs.to_rgba(cs.cvalues[-1], cs.alpha))
Expand All @@ -1126,7 +1126,7 @@ def clean_args(_args):
lws = args['lw'] # note linewidth_contour is only used for filled contours
kwargs = self._get_plot_args(plotno, **kwargs)
kwargs['alpha'] = alpha
cs = ax.contour(density.x, density.y, density.P, sorted(contour_levels), colors=cols, linestyles=linestyles,
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:
Expand Down

0 comments on commit eaf73a3

Please sign in to comment.