Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
38 views
ubuntu2204
Kernel: Python 3 (CoCalc)
from bokeh.plotting import figure, show, output_notebook from bokeh.layouts import gridplot import numpy as np output_notebook()
MIME type unknown not supported
x = np.linspace(0, 10, 100) y = np.sin(x) p1 = figure(title="Basic Line Plot", x_axis_label='x', y_axis_label='y') p1.line(x, y, legend_label="sin(x)", line_width=2) show(p1)
MIME type unknown not supported
x2 = np.linspace(0, 10, 100) y2a = np.sin(x2) y2b = np.cos(x2) p2 = figure(title="Multiple Line Plot", x_axis_label='x', y_axis_label='values') p2.line(x2, y2a, legend_label='sin(x)', line_color="blue") p2.line(x2, y2b, legend_label='cos(x)', line_color="green") show(p2)
MIME type unknown not supported
np.random.seed(42) x3 = np.random.rand(100) y3 = np.random.rand(100) p3 = figure(title="Scatter Plot") p3.scatter(x3, y3, size=8, color="navy", alpha=0.5) show(p3)
MIME type unknown not supported
fruits = ['Apples', 'Pears', 'Nectarines', 'Plums', 'Grapes', 'Blueberries'] counts = [5, 3, 4, 2, 4, 6] p4 = figure(x_range=fruits, title="Fruit Counts") p4.vbar(x=fruits, top=counts, width=0.9) show(p4)
MIME type unknown not supported
layout = gridplot([[p1, p2], [p3, p4]]) show(layout)
MIME type unknown not supported
from bokeh.plotting import figure, show, output_notebook from bokeh.layouts import gridplot import numpy as np output_notebook()
MIME type unknown not supported
x = np.linspace(0, 10, 100) y = np.sin(x)