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

Plot outputs

There are two methods you can use to render your plot:

  • output_file: This method is used to output your plot as an HTML file and can be used as illustrated in the following code: 
output_file('plot.html')
  • output_notebook: This is used to output your plot in the Jupyter Notebook you are presently working on and can be used as illustrated in the following code:
output_notebook()

Interfaces:

The first step to understanding interfaces is to understand what a class and a method are. Think of a class as a vessel that holds different types of cookie together. The vessel in this case is the class and the cookies are the methods that give the vessel some functionality, in our case, as  a container for the cookies. 

Since Python is an object-oriented programming language, it uses classes to group different objects that it creates together. 

A class by itself is useless unless it has some functionality associated with it. These functionalities are provided to classes by methods.

Bokeh provides a mid-level plotting interface, similar to that of matplotlib , which is known as bokeh.plottingThe main class in the bokeh.plotting interface is the Figure class, which includes methods for adding different kinds of glyphs to a plot. 

A user can create a Figure object by using the figure function, as illustrated in the following code: 

from bokeh.plotting import figure

# create a Figure object
p = figure(plot_width=500, plot_height=400, tools="pan,hover")

In Bokeh, the figure function, as illustrated in the preceding code, is used to initialize and store the contents of your plot. The variable p in the preceding code now holds information about the plot, including its height, width, and the kind of tools the plot will use. Since figure is our main class, methods such as line, circle, and so on can be added to our diagram in order to create the plot.

主站蜘蛛池模板: 宝丰县| 澄迈县| 琼结县| 大名县| 泾阳县| 江津市| 康平县| 会理县| 白山市| 玉林市| 玛沁县| 明光市| 隆子县| 永嘉县| 西宁市| 江都市| 邵东县| 法库县| 洪泽县| 三原县| 顺平县| 正定县| 湘阴县| 哈巴河县| 嘉荫县| 桐乡市| 霞浦县| 肥城市| 霍邱县| 义马市| 德昌县| 丹寨县| 剑河县| 台山市| 雅安市| 东方市| 南开区| 金山区| 黑龙江省| 禹州市| 勃利县|