From ae955c3c0cbdbf8dccbf2ffbffda58b3131c3c1a Mon Sep 17 00:00:00 2001 From: gautam-404 Date: Thu, 16 Jan 2025 16:16:35 +0530 Subject: [PATCH 1/4] test new hatches --- mesaPlot/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesaPlot/plot.py b/mesaPlot/plot.py index f248c53..99a1c60 100644 --- a/mesaPlot/plot.py +++ b/mesaPlot/plot.py @@ -5620,7 +5620,7 @@ def plotKip3( colors="none", alpha=0.0, norm=mixNorm, - hatches=["//", "-", "x", "+", "\\", "/"], + hatches=["//", "x", "\\\\", "||", "*", "..."], antialiased=True, ) ax.contour(lin_x, data_y, mix_data.T, colors=hatch_color, norm=mixNorm) From 345de699a8aa26a732a174e9f4b7b7d16cfd30f8 Mon Sep 17 00:00:00 2001 From: gautam-404 Date: Thu, 16 Jan 2025 18:57:15 +0530 Subject: [PATCH 2/4] mix hatch patterns and colors --- mesaPlot/plot.py | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/mesaPlot/plot.py b/mesaPlot/plot.py index 99a1c60..5d56a6e 100644 --- a/mesaPlot/plot.py +++ b/mesaPlot/plot.py @@ -5335,6 +5335,8 @@ def plotKip3( zone_frac=1.0, num_zones=None, mix_hatch=False, + mix_hatch_patterns = ["//", "...", "\\\\", "||", "x", "*"], + mix_hatch_colors = ['chartreuse', 'purple', 'red', 'gold', 'brown', 'gray'], hatch_color="black", hatch_func=None, zaxis_norm=False, @@ -5612,17 +5614,36 @@ def plotKip3( if show_mix: mixCmap, mixNorm = self._setMixRegionsCol(kip=True) if mix_hatch: - plt.rcParams["hatch.color"] = hatch_color - ax.contourf( + from matplotlib.patches import PathPatch + + # Create a filled contour plot (only to extract paths) + filled_contours = ax.contourf( lin_x, data_y, mix_data.T, - colors="none", + colors='none', alpha=0.0, - norm=mixNorm, - hatches=["//", "x", "\\\\", "||", "*", "..."], + hatches=mix_hatch_patterns, antialiased=True, ) + + # manage hatches and colors + num_collections = len(filled_contours.collections) + patterns = (mix_hatch_patterns * (num_collections // len(mix_hatch_patterns) + 1))[:num_collections] + colors = (mix_hatch_colors * (num_collections // len(mix_hatch_colors) + 1))[:num_collections] + + # applying hatches and colors dynamically + for collection, hatch, color in zip(filled_contours.collections, patterns, colors): + for path in collection.get_paths(): + patch = PathPatch( + path, + edgecolor=color, + facecolor='none', + hatch=hatch, + linewidth=0.5, + alpha=1.0, + ) + ax.add_patch(patch) # Add the patch to the axes ax.contour(lin_x, data_y, mix_data.T, colors=hatch_color, norm=mixNorm) else: ax.imshow( From cfe7a9f70cac6452ced765c5cc47bbbc7f0e4c59 Mon Sep 17 00:00:00 2001 From: Anuj Gautam Date: Thu, 13 Mar 2025 12:26:23 +1000 Subject: [PATCH 3/4] kip3 updated yaxis_norm for history plot type --- mesaPlot/plot.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mesaPlot/plot.py b/mesaPlot/plot.py index 2730da0..f1775a6 100644 --- a/mesaPlot/plot.py +++ b/mesaPlot/plot.py @@ -5489,6 +5489,11 @@ def plotKip3( mix_data = self._rebinKipDataX( mix_data, data_x[modInd], lin_x, nan=True, nan_value=1 ) + + if yaxis_norm: + data_y_min, data_y_max = np.min(data_y), np.max(data_y) + if data_y_max > data_y_min: + data_y = (data_y - data_y_min) / (data_y_max - data_y_min) else: show_mix = False From fe1a02af666ad173d2ae9de3b7c537625edede29 Mon Sep 17 00:00:00 2001 From: Anuj Gautam Date: Tue, 18 Mar 2025 10:26:06 +1000 Subject: [PATCH 4/4] Update plot.py --- mesaPlot/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesaPlot/plot.py b/mesaPlot/plot.py index f1775a6..6fc439e 100644 --- a/mesaPlot/plot.py +++ b/mesaPlot/plot.py @@ -5649,7 +5649,7 @@ def plotKip3( alpha=1.0, ) ax.add_patch(patch) # Add the patch to the axes - ax.contour(lin_x, data_y, mix_data.T, colors=hatch_color, norm=mixNorm) + ax.contour(lin_x, data_y, mix_data.T, colors=mix_hatch_colors, norm=mixNorm) else: ax.imshow( mix_data.T,