官术网_书友最值得收藏!

Creating line plots

We can plot a simple line plot in Bokeh using the following code: 

#Importing the required packages

from bokeh.io import output_file, show

from bokeh.plotting import figure

#Creating our data arrays used for plotting the line plot

x = [5,6,7,8,9,10]

y = [1,2,3,4,5,6]

#Calling the figure() function to create the figure of the plot

plot = figure()

#Creating a line plot using the line() function

plot.line(x,y)

#Creating markers on our line plot at the location of the intersection between x and y

plot.cross(x,y, size = 15)

#Output the plot

output_file('line_plot.html')

show(plot)

This results in a plot illustrated as follows:

In the preceding code, we first called the figure() function as a way to instruct Bokeh to construct a diagram. Once we've done this, we can then add layers of glyphs or geometric shapes to our diagram. 

We first added the line() glyph to the figure in order to construct the line plot and then added the cross() glyph on top of the line to mark intersections between the x and y points. 

主站蜘蛛池模板: 咸宁市| 萍乡市| 宿迁市| 凤城市| 柳江县| 榆社县| 寻乌县| 临桂县| 丹棱县| 大连市| 建阳市| 仙居县| 肇庆市| 唐山市| 霍邱县| 株洲市| 云龙县| 合阳县| 晋州市| 渭源县| 密云县| 乌鲁木齐市| 靖宇县| 邹城市| 华安县| 房产| 客服| 凤庆县| 江永县| 阜宁县| 彩票| 花莲县| 丹棱县| 阳曲县| 晋宁县| 昭平县| 金山区| 宁强县| 滁州市| 绥阳县| 临清市|