<jupyter_start><jupyter_text>Creating a list of colors from a given colormap<jupyter_code>'''%%!
This example shows how to obtain an equally distributed set of colors from a given colormap.
The function gen_color takes two arguments: cmap and n
cmap is any cmap value from matplotlib: https://matplotlib.org/stable/tutorials/colors/colormaps.html
n= number of color you want from that colormap range
'''
color1=mcp.gen_color(cmap="winter",n=5)
print(color1)
#plt.scatter(color1,color1,c=color1)
color2=mcp.gen_color(cmap="bwr",n=16)
plt.scatter(color2,color2,c=color2)
print(color2)<jupyter_output>['#0000ff', '#0040df', '#0080bf', '#00c09f', '#00ff80']
['#0000ff', '#2222ff', '#4444ff', '#6666ff', '#8888ff', '#aaaaff', '#ccccff', '#eeeeff', '#ffeeee', '#ffcccc', '#ffaaaa', '#ff8888', '#ff6666', '#ff4444', '#ff2222', '#ff0000']<jupyter_text>Creating a list of colors normailized to a given data in an numpy array<jupyter_code>a=random.randint(1000, size=(200))
a=np.array(a)
color1=mcp.gen_color_normalized(cmap="seismic",data_arr=a)
plt.scatter(a,a,c=color1)<jupyter_output><empty_output><jupyter_text>With reverse<jupyter_code>color1=mcp.gen_color_normalized(cmap="seismic",data_arr=a,reverse=True)
plt.scatter(a,a,c=color1)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1675933280381255, 'fraction_numerical': 0.06671961874503574, 'mean_word_length': 9.76923076923077, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '443350', 'license': 'MIT', 'n_tokens_mistral': 550, 'n_tokens_neox': 490, 'n_words': 97, 'path': 'usage_example.ipynb', 'repo_name': 'binodbhttr/mycolorpy', 'size': '1259'}