<jupyter_start><jupyter_text><jupyter_code>import numpy as np
from matplotlib import pyplot as plt
import plotly.express as px
sketchy = np.zeros((100,100))
from ipywidgets import interact, interactive, fixed, interact_manual
from IPython.display import display, Markdown, clear_output
def f(x,y):
  sketchy[x,y]=1
  if 1: #use matplotlib
    plt.ion()
    plt.imshow(sketchy)
    plt.show()
  if 0: #use plotly
    fig = px.imshow(sketchy)
    fig.update_layout(width=400, height=400, margin=dict(l=10, r=10, b=10, t=10))
    fig.update_xaxes(showticklabels=False).update_yaxes(showticklabels=False)
    fig.show()
import ipywidgets as widgets
from IPython.display import display
button = widgets.Button(description="Click Me!")
output = widgets.Output()

display(button, output)

def on_button_clicked(b):
    with output:
        print("Button clicked.")

button.on_click(on_button_clicked)
button = widgets.Button(description='My Button')
out = widgets.Output()
x=0
y=50
def on_button_clicked(_):
      # "linking function with output"

      with out:
          # what happens when we press the button
          clear_output()
          # x+=1
          f(x,y)
          print('hi')
# linking button and function together using a button's method
button.on_click(on_button_clicked)
# displaying button and its output together
widgets.VBox([button,out])
interact(f, x=50, y=50);
# interact_manual(f, x=50, y=50);
fig = px.imshow(sketchy)
fig.update_layout(width=400, height=400, margin=dict(l=10, r=10, b=10, t=10))
fig.update_xaxes(showticklabels=False).update_yaxes(showticklabels=False)
fig.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12063686466625842, 'fraction_numerical': 0.030006123698714023, 'mean_word_length': 4.753521126760563, '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': '566126', 'license': 'MIT', 'n_tokens_mistral': 610, 'n_tokens_neox': 573, 'n_words': 134, 'path': 'sketchySketch.ipynb', 'repo_name': 'kevinkmcguigan/sketchysketch', 'size': '1633'}