def _line_scatter(h1, kind, show=True, **kwargs):
"""Line or scatter plot.
The common functionality (the plots differ only in method called).
"""
density = kwargs.pop("density", False)
cumulative = kwargs.pop("cumulative", False)
size = kwargs.pop("size", 8)
p = kwargs.pop("figure", _create_figure(h1))
data = get_data(h1, cumulative=cumulative, density=density)
plot_data = {
"x" : h1.bin_centers,
"y" : data
}
if kind == "line":
p.line(plot_data['x'], plot_data['y'])
elif kind == "scatter":
p.scatter(plot_data['x'], plot_data['y'], size=size)
if show:
bokeh_show(p)
return p
评论列表
文章目录