[PYTHON] How to use the graph drawing library Bokeh

・ It is possible to check the contents of the data with a tooltip.

import matplotlib.pyplot as plt
import numpy as np
import random

from bokeh.io import output_notebook, show
from bokeh.plotting import figure,show
output_notebook()

x = np.linspace(1, 10, 10)
y = [random.randint(0, 10) for i in range(10)]

TOOLTIPS = [
    ("index", "$index"),
    ("(x,y)", "($x, $y)"),
]

#Graph settings
p = figure(tooltips=TOOLTIPS, title="Graph title", x_axis_label="x axis", y_axis_label="y axis")
#Scatter plot
p.circle(x = x,y = y)
#show(p)

#Line graph
#p.line(x = x,y = y)
#show(p)

#bar graph
#p.vbar(x = x,top = y,width=0.5)
show(p)

Recommended Posts

How to use the graph drawing library Bokeh
[Python] How to use the graph creation library Altair
How to use the C library in Python
How to use the generator
How to use the decorator
How to use the Rubik's Cube solver library "kociemba"
How to use the zip function
How to use the optparse module
How to use Requests (Python Library)
[Python] How to import the library
How to use the ConfigParser module
Notes on how to use marshmallow in the schema library
[Introduction to Data Scientists] Basics of scientific calculation, data processing, and how to use the graph drawing library ♬ Environment construction
How to use the Spark ML pipeline
[Linux] How to use the echo command
How to use the Linux grep command
How to use the IPython debugger (ipdb)
How to use xml.etree.ElementTree
How to use Python-shell
How to use tf.data
How to use virtualenv
How to use MkDocs for the first time
How to use Seaboan
How to use image-match
How to use shogun
How to use Virtualenv
How to use numpy.vectorize
How to use pytest_report_header
How to use Python Image Library in python3 series
How to use partial
How to use Bio.Phylo
How to use SymPy
How to use x-means
How to use WikiExtractor.py
How to use the library "torchdiffeq" that implements Neural ODE's ODE Block
How to use IPython
How to use the Google Cloud Translation API
How to use virtualenv
How to use the NHK program guide API
How to use Matplotlib
[Algorithm x Python] How to use the list
How to use iptables
How to use numpy
How to use TokyoTechFes2015
How to use venv
How to use dictionary {}
How to use Pyenv
[Introduction to Data Scientists] Basics of scientific calculation, data processing, and how to use graph drawing library ♬ Basics of Scipy
How to use PyTorch-based image processing library "Kornia"
How to use list []
How to use python-kabusapi
How to use OptParse
[Introduction to Data Scientists] Basics of scientific calculation, data processing, and how to use graph drawing library ♬ Basics of Pandas
[Introduction to Data Scientists] Basics of scientific calculation, data processing, and how to use graph drawing library ♬ Basics of Matplotlib
How to use return
How to use dotenv
How to use pyenv-virtualenv
How to use Go.mod
How to use imutils
How to use import
How to use the Raspberry Pi relay module Python