In [1]:
from bokeh.charts import Bar,output_file,show,color,Line,Scatter,Histogram,output_notebook
import numpy
from bokeh.plotting import figure
import pandas as pd

from bokeh.charts import defaults

defaults.width = 450
defaults.height = 350

In [ ]:


In [2]:
# build a dataset where multiple columns measure the same thing
data = dict(python=[2, 3, 7, 5, 26, 221, 44, 233, 254, 265, 266, 267, 120, 111],
            pypy=[12, 33, 47, 15, 126, 121, 144, 233, 254, 225, 226, 267, 110, 130],
            jython=[22, 43, 10, 25, 26, 101, 114, 203, 194, 215, 201, 227, 139, 160],
            test=['foo', 'bar', 'foo', 'bar', 'foo', 'bar', 'foo', 'bar', 'foo', 'bar',
                  'foo', 'bar', 'foo', 'bar']
            )

# create a line chart where each column of measures receives a unique color and dash style
line = Line(data, y=['python', 'pypy', 'jython'],
            dash=['python', 'pypy', 'jython'],
            color=['python', 'pypy', 'jython'],
            title="Interpreter Sample Data", 
            ylabel='Duration', 
            legend=True)

output_file("line_single.html", title="line_single.py example")

show(line)

In [3]:
hist = Histogram(numpy.random.random(size=(1000)),
                 xgrid=True,
                 ygrid=True,
                 bins=30,
                 yscale='Linear')#,color='#aa4444')
output_file("histogram.html", title="Histogram example")

show(hist)

In [ ]:


In [5]:
from bokeh.charts import Histogram, output_file, show
from bokeh.sampledata.autompg import autompg as df

p = Histogram(df, values='hp', color='navy', title="HP Distribution")

output_file("histogram_color.html")

show(p)

In [6]:
# create a new plot with default tools, using figure
p = figure(plot_width=400, plot_height=400,title="Epoch time vs Batch Size") #x_range=[0,10], y_range=[0,10]
p.outline_line_width = 7
p.outline_line_alpha = 0.3
#p.outline_line_color = "navy"
# change just some things about the x-axes
p.xaxis.axis_label = "Temp"
p.xaxis.axis_line_width = 3
#p.xaxis.axis_line_color = "red"

# change just some things about the y-axes
p.yaxis.axis_label = "Pressure"
#p.yaxis.major_label_text_color = "orange"
p.yaxis.major_label_orientation = "vertical"

# change things on all axes
p.axis.minor_tick_in = -3
p.axis.minor_tick_out = 6


p.legend.location = "bottom_left"


# add a line renderer
p.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=2) #line_dash="4 4", line_width=1, color='gray',legend="3*sin(x)"
#line_color, line_alpha, line_width and line_dash.marker='cyl', color='cyl',

## put all the plots in a gridplot
p = gridplot([[p1, p2, p3]], toolbar_location=None)


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-6-95fc41cb2f2d> in <module>()
     28 
     29 ## put all the plots in a gridplot
---> 30 p = gridplot([[p1, p2, p3]], toolbar_location=None)

NameError: name 'gridplot' is not defined

In [7]:
scatter = p.scatter(x=numpy.random.random(size=(100)),
                    y = numpy.random.random(size=(100)),size=15, 
                    line_color="navy", 
                    fill_color="orange", 
                    fill_alpha=0.5,
                    marker='square')

# keep a reference to the returned GlyphRenderer
r = p.circle([1,2,3,4,5], [2,5,8,2,7])

r.glyph.size = 50
r.glyph.fill_alpha = 0.2
r.glyph.line_color = "firebrick"
r.glyph.line_dash = [5, 1]
r.glyph.line_width = 2

show(p)

In [60]:


In [ ]:
TExt

 fill_color and fill_alpha.

Text Properties
Set the visual appearance of lines of text. The most common are text_font, text_font_size, text_color, and text_alpha.