You can download this code by clicking the button below.
This code is now available for download.
This function uses the Bokeh library to plot a random line chart, with x and y values generated randomly from the Numpy library.
Technology Stack : Bokeh, Numpy
Code Type : Graphics drawing
Code Difficulty : Intermediate
import numpy as np
from bokeh.plotting import figure, show
from bokeh.layouts import gridplot
def random_line_plot(x_values, y_values):
# Create a new plot with a title and axis labels
p = figure(title="Random Line Plot", x_axis_label='X Values', y_axis_label='Y Values')
# Add a line renderer with a legend and line thickness
p.line(x_values, y_values, legend_label="Line", line_width=2)
# Add a grid to the plot
p.grid()
# Show the plot
show(p)
# Example usage:
x_values = np.random.rand(10)
y_values = np.random.rand(10)
random_line_plot(x_values, y_values)