<jupyter_start><jupyter_text>Grouping data by categoryWhen plotting, its useful to have a way to color points by some category orvariable.  Hypertools does this using the `hue` kwarg, which takes a listof string category labels or numerical values.  If text labels are passed, thedata is restructured according to those labels and plotted in different colorsaccording to your color palette.  If numerical values are passed, the valuesare binned (default resolution: 100) and plotted according to your colorpalette.<jupyter_code># Code source: <NAME>
# License: MIT

# import
import hypertools as hyp
import numpy as np

# load example data
geo = hyp.load('weights_sample')
data = geo.get_data()

# simulate random groups
hue=[]
for idx,i in enumerate(data):
    tmp=[]
    for iidx,ii in enumerate(i):
            tmp.append(int(np.random.randint(1000, size=1)))
    hue.append(tmp)

# plot
geo.plot(fmt='.', hue=hue)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08447729672650475, 'fraction_numerical': 0.008447729672650475, 'mean_word_length': 4.815950920245399, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '294619', 'license': 'MIT', 'n_tokens_mistral': 294, 'n_tokens_neox': 274, 'n_words': 113, 'path': 'docs/auto_examples/plot_hue.ipynb', 'repo_name': 'timgates42/hypertools', 'size': '955'}