<jupyter_start><jupyter_text>Playing with trying to get hovering tool time with density plots.<jupyter_code>import matplotlib.pyplot as plt
%matplotlib inline
import mpld3
import numpy as np
import pandas as pd
# Create test dataset
dat = pd.DataFrame({'one': np.random.normal(size=1000), 
                    'two': np.random.normal(loc=0.1, size=1000), 
                    'three': np.random.normal(loc=-0.1, size=1000)
                    })

dat.head(3)
dat.plot(kind='kde')
fig, ax = plt.subplots(figsize=(8,8))
density = dat.plot(kind='kde', ax=ax)
labels = [x.get_label() for x in density.get_lines()]

t1 = mpld3.plugins.LineLabelTooltip(density.get_lines()[0], labels[0])
t2 = mpld3.plugins.LineLabelTooltip(density.get_lines()[1], labels[1])
t3 = mpld3.plugins.LineLabelTooltip(density.get_lines()[2], labels[2])

mpld3.plugins.connect(fig, t1, t2, t3)
mpld3.display()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15181518151815182, 'fraction_numerical': 0.0407040704070407, 'mean_word_length': 4.352941176470588, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '492155', 'license': 'MIT', 'n_tokens_mistral': 344, 'n_tokens_neox': 331, 'n_words': 66, 'path': 'notebook/.ipynb_checkpoints/mpld3_kde_plot-checkpoint.ipynb', 'repo_name': 'GalaxyDream/SECIMTools', 'size': '909'}