From a13c5e9af6923e2a16aff1d7724d7c63b3486269 Mon Sep 17 00:00:00 2001 From: NicolasCami <11176884+NicolasCami@users.noreply.github.com> Date: Mon, 22 Apr 2024 16:57:04 +0200 Subject: [PATCH 1/2] [fix] Plot 2D curve: Merge paths instead of using the first path returned by fill_betweenx --- welly/plot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/welly/plot.py b/welly/plot.py index dae3c8a0..bdfed9b7 100644 --- a/welly/plot.py +++ b/welly/plot.py @@ -393,9 +393,14 @@ def plot_2d_curve(curve, x2=np.nanmin(curve_data), facecolor='none', **kwargs) + + # Combine the paths into a single Path object + vertices = np.concatenate([p.vertices for p in paths._paths]) + codes = np.concatenate([p.codes for p in paths._paths]) + merged_paths = mpl.path.Path(vertices, codes) # Make the 'fill' mask and clip the background image with it. - patch = PathPatch(paths._paths[0], visible=False) + patch = mpl.patches.PathPatch(merged_paths, visible=False) ax.add_artist(patch) im.set_clip_path(patch) else: From 16a1d3faa727391e5aa38f88287eff83b9b24d4f Mon Sep 17 00:00:00 2001 From: NicolasCami <11176884+NicolasCami@users.noreply.github.com> Date: Mon, 22 Apr 2024 17:20:45 +0200 Subject: [PATCH 2/2] [fix] Fix typo --- welly/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/welly/plot.py b/welly/plot.py index bdfed9b7..c31b6859 100644 --- a/welly/plot.py +++ b/welly/plot.py @@ -400,7 +400,7 @@ def plot_2d_curve(curve, merged_paths = mpl.path.Path(vertices, codes) # Make the 'fill' mask and clip the background image with it. - patch = mpl.patches.PathPatch(merged_paths, visible=False) + patch = PathPatch(merged_paths, visible=False) ax.add_artist(patch) im.set_clip_path(patch) else: