<jupyter_start><jupyter_text>Plot with customized toolbar and vectorized color palettesCreating a plot with a customized toolbar and vectorized color palettes.<jupyter_code># Data handing tools
import numpy as np

# Bokeh tools
from bokeh.plotting import figure, show, output_file
from bokeh.io import curdoc, output_notebook
from bokeh.models import HoverTool, BoxZoomTool, PanTool, ResetTool
from bokeh.palettes import Viridis
from bokeh.transform import linear_cmap<jupyter_output><empty_output><jupyter_text>Setting plot to show inside the notebook and on a html webpage.<jupyter_code>output_file('vectorized_glyphs_and_color_palettes.html')
output_notebook()<jupyter_output><empty_output><jupyter_text>Generating random values.<jupyter_code>x = np.random.randint(10, 20, size=10)
y = np.random.randint(0, 100, size=10)<jupyter_output><empty_output><jupyter_text>Setting up a figure frame.<jupyter_code>p = figure(title='Vectorized Glyphs and Color Palettes 01',
           sizing_mode='stretch_width',
           plot_height=500,
           x_axis_label='x-axis',
           y_axis_label='y-axis',
           tools=[HoverTool(), BoxZoomTool(), PanTool(), ResetTool()],
           tooltips='(@x, @y)'
           )

p.toolbar.autohide = True
p.toolbar.logo = None
p.outline_line_color='black'<jupyter_output><empty_output><jupyter_text>Setting the dependency between value and color<jupyter_code>colors = ['#%02x%02x%02x' % (255, int(round(value * 2.55)), 100) for value in y]
circle = p.circle(x, y, fill_color=colors, line_color='blue', size=20)<jupyter_output><empty_output><jupyter_text>Creating a scatter plot inside the figure.<jupyter_code>show(p)<jupyter_output><empty_output><jupyter_text>Setting up color palette map.<jupyter_code>x = np.random.randint(-10, 10, size=50)
y=[i**2 for i in x]
color_map = linear_cmap(field_name='y', palette=Viridis[10], low=min(y), high=max(y))
p2 = figure(title='Vectorized Glyphs and Color Palettes 02',
           sizing_mode='stretch_width',
           plot_height=500,
           x_axis_label='x-axis',
           y_axis_label='y-axis',
           )
circle2 = p2.circle(x, y, color=color_map, size=20)
show(p2)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11735159817351598, 'fraction_numerical': 0.024657534246575342, 'mean_word_length': 5.425219941348973, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '348352', 'license': 'Apache-2.0', 'n_tokens_mistral': 810, 'n_tokens_neox': 756, 'n_words': 160, 'path': 'vectorized_glyphs_and_color_palettes/vectorized_glyphs_and_color_palettes.ipynb', 'repo_name': 'ofir-frd/Bokeh-Training', 'size': '2190'}