Example #1
0
def generate_box_plot(sdf, colors):
	"""
	The colors were hacked in here!
	If the columns are not as in the order below in the final output, the colors will be wrong!
	"""
	from bokeh.charts import BoxPlot
	from bokeh.charts import color
	box_colors = [colors["HGST"], colors["Hitachi"], colors["Seagate"], colors["Toshiba"], colors["Western Digital"]]
	#palette = box_colors
	#print(box_colors)
	plot = BoxPlot(sdf, values='failure_rate', label='manufacturer',
            title="Failure Rate by Manufacturer", outliers=False, 
            color=color(columns=['manufacturer'], palette=box_colors), legend=False, tools=None)

	plot.yaxis.axis_label = "Failure Rate"
	plot.xaxis.axis_line_width = 2
	plot.yaxis.axis_line_width = 2
	plot.title.text_font_size = '16pt'
	plot.xaxis.axis_label_text_font_size = "14pt"
	plot.xaxis.major_label_text_font_size = "14pt"
	plot.yaxis.axis_label_text_font_size = "14pt"
	plot.yaxis.major_label_text_font_size = "14pt"
	plot.y_range = Range1d(0, 15)
	plot.ygrid.grid_line_color = None
	plot.toolbar.logo = None
	plot.outline_line_width = 0
	plot.outline_line_color = "white"
	return plot