MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / make_matplotlib

Function make_matplotlib

wrappers/Python/CoolProp/Plots/HSFlashTimingMap.py:171–200  ·  view source on GitHub ↗
(df, title, png_path, xcol, ycol, xlabel, ylabel, overlay)

Source from the content-addressed store, hash-verified

169
170
171def make_matplotlib(df, title, png_path, xcol, ycol, xlabel, ylabel, overlay):
172 import matplotlib.pyplot as plt
173 from matplotlib.colors import LogNorm
174
175 fig, axes = plt.subplots(1, 3, figsize=(18, 6), sharey=True)
176 sc0 = axes[0].scatter(df[xcol], df[ycol], c=df["evals"].clip(lower=1), s=6, cmap="viridis", norm=LogNorm())
177 fig.colorbar(sc0, ax=axes[0], label="EOS evals (log)")
178 axes[0].set_title("EOS evaluations")
179 sc1 = axes[1].scatter(df[xcol], df[ycol], c=df["microseconds"].clip(lower=1e-3), s=6, cmap="inferno", norm=LogNorm())
180 fig.colorbar(sc1, ax=axes[1], label="solve time [us] (log)")
181 axes[1].set_title("Solve time")
182 for m, label in METHOD_LABEL.items():
183 sub = df[df["method"] == m]
184 if len(sub):
185 axes[2].scatter(sub[xcol], sub[ycol], s=6, c=METHOD_COLOR[m], label=label)
186 axes[2].legend(loc="best", fontsize=8)
187 axes[2].set_title("Cascade leg")
188 if overlay:
189 for ax in axes:
190 for (lx, ly, _) in overlay["lines"]:
191 ax.plot(lx, ly, "k-", lw=3)
192 ax.plot(lx, ly, "y-", lw=1.4)
193 ax.plot(*overlay["crit"], "x", color="yellow", mec="black", ms=9)
194 for ax in axes:
195 ax.set_xlabel(xlabel)
196 axes[0].set_ylabel(ylabel)
197 fig.suptitle(title)
198 fig.tight_layout()
199 fig.savefig(png_path, dpi=130)
200 print("Wrote static plot:", png_path)
201
202
203def render(df, title, base, coord, overlay):

Callers 1

renderFunction · 0.85

Calls 3

plotMethod · 0.45
tight_layoutMethod · 0.45
savefigMethod · 0.45

Tested by

no test coverage detected