<jupyter_start><jupyter_text>Visual tests for plotly_scatter function<jupyter_code>import pandas as pd
import numpy as np
from pybleau.plotly_api.api import plotly_scatter, plotly_hist, plotly_bar, BLACK, BLUE, GREEN, PURPLE, RED
data = pd.DataFrame({"a": list("abcdcbabcdcb"), "b": np.arange(12), "c": np.arange(0, 120, 10), 
                     "d": np.random.randn(12), "e": np.random.randn(12)}, 
                    index=list("xyzwvuabcdef"))
data<jupyter_output><empty_output><jupyter_text>2D scatters<jupyter_code>plotly_scatter("b", "c", data=data)
plotly_scatter("b", "c", data=data, hover="index")
plotly_scatter("b", "c", data=data, hover="a")
# Static color defined in module:
plotly_scatter("b", "c", data=data, symbol="square", hue=PURPLE)
# Static color using RGB code:
plotly_scatter("b", "c", data=data, symbol="square", hue="rgb(225, 0, 0)")
# Color set by the values of a column:
plotly_scatter("b", "c", data=data, hue="a")
plotly_scatter("b", "c", data=data, symbol="a", hue="rgb(255, 0, 0)")
# Symbols from an integer column:
plotly_scatter("d", "c", data=data, symbol="b")
plotly_scatter("b", "c", data=data, symbol="a", hover="index")
plotly_scatter("b", "c", data=data, symbol="a", hover="a")
plotly_scatter("b", "c", data=data, symbol="a", hue="index")
# Color by a column but override the color map:
color_map = {"a": BLACK, "b": BLUE, "c": RED, "d": GREEN}
plotly_scatter("b", "c", data=data, hue="a", palette=color_map)<jupyter_output><empty_output><jupyter_text>3D scatters<jupyter_code>plotly_scatter(x="e", y="c", z="d", data=data)
plotly_scatter(x="e", y="c", z="d", data=data, hue="a")
plotly_scatter(x="e", y="c", z="d", data=data, hue="a", hover="index")<jupyter_output><empty_output><jupyter_text>Histograms<jupyter_code>data2 = pd.DataFrame({"d": np.random.randn(200), "e": np.random.randn(200)})
plotly_hist(x="d", data=data2)
plotly_hist(x="d", data=data, hue=RED)
plotly_hist(x="d", data=data, hue=RED, bins=10)
plotly_hist(x=["d", "e"], data=data2, hue=[BLUE, RED], marker_alpha=0.6)<jupyter_output><empty_output><jupyter_text>Bar plot<jupyter_code>plotly_bar(x="index", y="b", data=data)
plotly_bar(x="index", y=["b", "d"], data=data)
plotly_bar(x="index", y=["b", "d"], data=data, barmode="stack")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.21381434227892654, 'fraction_numerical': 0.01627804663440387, 'mean_word_length': 8.132530120481928, 'pattern_counts': {'":': 11, '<': 21, '<?xml version=': 0, '>': 21, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '637211', 'license': 'MIT', 'n_tokens_mistral': 977, 'n_tokens_neox': 924, 'n_words': 183, 'path': 'scripts/plotly_api_visual_tests.ipynb', 'repo_name': 'jonathanrocher/pybleau', 'size': '2273'}