bokeh 3rd: high-level charts
Where to get Bokeh high-level charts that can be simply created through pandas DataFrame?
Histograms¶
- from bokeh.charts import Histogram
- Histogram(df, 'column name',...)
In [1]:
from bokeh.charts import Histogram,output_file, output_notebook, show
from bokeh.sampledata.iris import flowers as df
# bokeh.io
from bokeh.plotting import figure
In [2]:
output_notebook()
In [3]:
df.head(0)
Out[3]:
In [4]:
# figure(plot_width=400,plot_height=400)
p=Histogram(df, 'petal_length',title='Iris Morphology',\
plot_width=500,plot_height=400,\
bins=25, color='silver')
show(p)
group by categories map to color¶
In [5]:
p=Histogram(df, values='petal_length',title='Iris Morphology',\
plot_width=600,plot_height=400,\
bins=5, color='species',legend='top_right')
# p.legend.location='bottom_right'
p.yaxis.axis_label='test,test,test'
show(p)
Boxplots¶
- box and whiskers
- from bokeh.charts import BoxPlot
- label='column you want to group'
- label are the groups
- Boxplots(df, values='', label='',color='', ...)
- pass cat data to color
- Boxplots(df, values='', label='',color='', ...)
- label are the groups
- label='column you want to group'
In [6]:
from bokeh.charts import BoxPlot
p=BoxPlot(df, values='petal_length',title='BoxPlot',\
plot_width=600,plot_height=400, color='species',\
label='species',legend='bottom_right')
p.yaxis.axis_label='This is a y label'
show(p)
In [7]:
from bokeh.charts import Scatter
In [8]:
p=Scatter(df, x='petal_length',y='sepal_length',
title='Iris what is Scatter', color='species', marker = 'species',
plot_width=600,plot_height=400)
show(p)
In [ ]: