Пример #1
0
def generate_single_bar(df, time_str, color_dict, colors):

	df = df[df.percent_total >= 3]
	title = "Failure Rate " + time_str
	fill = [color_dict[model_key] if model_key in color_dict else 'grey' for model_key in df.model]
	source = ColumnDataSource(dict(color=[c for c in df['color']],
		model=[m for m in df['model']],
		failure_rate=[f for f in df['failure_rate']],
		count=[co for co in df['count']]))

	plot = Bar(df, 'model', values='failure_rate', title=title, source=source, tools=['hover'],color='color', legend=None)
	# outline_line_color="color", border_fill_color='color', 
	hover = plot.select(dict(type=HoverTool))
	hover.tooltips = [
        ("Model ", "@model"),
        ("Failure rate ", "@y"),
        ("Number of drives", "@count")        #("Time ", "@timeline"),
        ]
	hover.mode = 'mouse'
	plot.xaxis.axis_label = 'Model Serial Number'
	plot.yaxis.axis_label = 'Naive Failure Rate'
	plot.title_text_font_size="18px"
	plot.grid.grid_line_alpha = 0
	plot.ygrid.grid_line_color = None
	plot.toolbar.logo = None
	plot.outline_line_width = 0
	plot.outline_line_color = "white"
	plot.plot_height = 600
	plot.plot_width = 800
	plot.xaxis.major_tick_line_color = None
	plot.yaxis.major_tick_line_color = None
	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"
	return(plot)
Пример #2
0
from bokeh.charts import Bar, output_file, show, vplot, hplot, defaults
from bokeh.sampledata.autompg import autompg as df

df['neg_mpg'] = 0 - df['mpg']

defaults.plot_width = 400
defaults.plot_height = 400

bar_plot = Bar(df, label='cyl', title="label='cyl'")
bar_plot.title_text_font_size = '10pt'

bar_plot2 = Bar(df,
                label='cyl',
                bar_width=0.4,
                title="label='cyl' bar_width=0.4")
bar_plot2.title_text_font_size = '10pt'

bar_plot3 = Bar(df,
                label='cyl',
                values='mpg',
                agg='mean',
                title="label='cyl' values='mpg' agg='mean'")
bar_plot3.title_text_font_size = '10pt'

bar_plot4 = Bar(df,
                label='cyl',
                title="label='cyl' color='DimGray'",
                color='dimgray')
bar_plot4.title_text_font_size = '10pt'

# multiple columns
Пример #3
0
from bokeh.charts import Bar, output_file, show, vplot, hplot, defaults
from bokeh.sampledata.autompg import autompg as df

df['neg_mpg'] = 0 - df['mpg']

defaults.plot_width = 400
defaults.plot_height = 400

bar_plot = Bar(df, label='cyl', title="label='cyl'")
bar_plot.title_text_font_size = '10pt'

bar_plot2 = Bar(df, label='cyl', bar_width=0.4, title="label='cyl' bar_width=0.4")
bar_plot2.title_text_font_size = '10pt'

bar_plot3 = Bar(df, label='cyl', values='mpg', agg='mean',
                title="label='cyl' values='mpg' agg='mean'")
bar_plot3.title_text_font_size = '10pt'

bar_plot4 = Bar(df, label='cyl', title="label='cyl' color='DimGray'", color='dimgray')
bar_plot4.title_text_font_size = '10pt'

# multiple columns
bar_plot5 = Bar(df, label=['cyl', 'origin'], values='mpg', agg='mean',
                title="label=['cyl', 'origin'] values='mpg' agg='mean'")
bar_plot5.title_text_font_size = '10pt'

bar_plot6 = Bar(df, label='origin', values='mpg', agg='mean', stack='cyl',
                title="label='origin' values='mpg' agg='mean' stack='cyl'",
                legend='top_right')
bar_plot6.title_text_font_size = '10pt'
Пример #4
0
from bokeh.charts import Bar, output_file, show, vplot, hplot, defaults
from bokeh.sampledata.autompg import autompg as df

df["neg_mpg"] = 0 - df["mpg"]

defaults.plot_width = 400
defaults.plot_height = 400

bar_plot = Bar(df, label="cyl", title="label='cyl'")
bar_plot.title_text_font_size = "10pt"

bar_plot2 = Bar(df, label="cyl", bar_width=0.4, title="label='cyl' bar_width=0.4")
bar_plot2.title_text_font_size = "10pt"

bar_plot3 = Bar(df, label="cyl", values="mpg", agg="mean", title="label='cyl' values='mpg' agg='mean'")
bar_plot3.title_text_font_size = "10pt"

bar_plot4 = Bar(df, label="cyl", title="label='cyl' color='DimGray'", color="dimgray")
bar_plot4.title_text_font_size = "10pt"

# multiple columns
bar_plot5 = Bar(
    df, label=["cyl", "origin"], values="mpg", agg="mean", title="label=['cyl', 'origin'] values='mpg' agg='mean'"
)
bar_plot5.title_text_font_size = "10pt"

bar_plot6 = Bar(
    df,
    label="origin",
    values="mpg",
    agg="mean",