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

Function log_color

wrappers/Python/CoolProp/Plots/HSFlashTimingMap.py:96–106  ·  view source on GitHub ↗

Map positive values to log10 for color, plus 1-2-5 decade colorbar ticks labelled with the ORIGINAL values (so the bulk variation is visible instead of being washed out by a few high-cost outliers).

(values)

Source from the content-addressed store, hash-verified

94
95
96def log_color(values):
97 """Map positive values to log10 for color, plus 1-2-5 decade colorbar ticks
98 labelled with the ORIGINAL values (so the bulk variation is visible instead of
99 being washed out by a few high-cost outliers)."""
100 v = np.asarray(values, dtype=float)
101 vp = v[v > 0]
102 vmin = vp.min() if len(vp) else 1.0
103 c = np.log10(np.clip(v, vmin, None))
104 ticks = [m * 10.0 ** e for e in range(int(np.floor(np.log10(vmin))), int(np.ceil(np.log10(v.max()))) + 1)
105 for m in (1, 2, 5) if vmin <= m * 10.0 ** e <= v.max()]
106 return c, np.log10(ticks), ["{0:g}".format(t) for t in ticks]
107
108
109def make_plotly(df, title, html_path, xcol, ycol, xlabel, ylabel, overlay):

Callers 1

make_plotlyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected