50f590603a1dd562453926edaab69267633b8455,python/hypertools/_shared/helpers.py,,vals2colors,#Any#Any#Any#,25
Before Change
palette = sns.color_palette(cmap, res)
// rank the values and then normalize
ranks = list(map(lambda x: sum([val <= x for val in vals]),vals))
ranks = list(map(lambda rank: int(res*rank/len(vals)),ranks))
return [palette[rank-1] for rank in ranks]
// this will be moved to utils.py
def is_list(x):
After Change
// get palette from seaborn
palette = np.array(sns.color_palette(cmap, res))
ranks = np.digitize(vals, np.linspace(np.min(vals), np.max(vals)+1, res+1)) - 1
return palette[ranks, :]
// this will be moved to utils.py
def is_list(x):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: ContextLab/hypertools
Commit Name: 50f590603a1dd562453926edaab69267633b8455
Time: 2016-12-20
Author: andrew.heusser@gmail.com
File Name: python/hypertools/_shared/helpers.py
Class Name:
Method Name: vals2colors
Project Name: matplotlib/matplotlib
Commit Name: 65338734d66c3e62d1ee1c960772f522dfa5e930
Time: 2019-05-02
Author: anntzer.lee@gmail.com
File Name: lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py
Class Name: FloatingAxisArtistHelper
Method Name: update_lim
Project Name: ContextLab/hypertools
Commit Name: 3c8f5966e66f2222d2cfa3770d2ac923d254b61a
Time: 2016-12-20
Author: andrew.heusser@gmail.com
File Name: python/hypertools/_shared/helpers.py
Class Name:
Method Name: vals2colors