from bokeh.plotting import figure, output_file, show from bokeh.models import Circle # define plot parameters output_file("circle.html") p = figure(plot_width=400, plot_height=400) # create and add Circle object to plot circle = Circle(x=1, y=2, radius=0.5, fill_color='red') p.add_glyph(circle) # display plot show(p)
from bokeh.plotting import figure, output_file, show from bokeh.models import Circle from random import randint # define plot parameters output_file("circle_sizes.html") p = figure(plot_width=400, plot_height=400) # create multiple Circle objects with random radius circles = [Circle(x=randint(0,10), y=randint(0,10), radius=randint(1,10), fill_color='blue') for i in range(5)] p.add_glyph(*circles) # display plot show(p)This code fragment creates a circle plot with five circles of random positions and radii. It demonstrates how you can use a loop to create multiple Circle objects and add them to a plot. In conclusion, the package library used for these examples is Python Bokeh.