The code seems to run fine for one entry, but when I loop it in a list im unable to see the plot.
Earlier the code was for just one vin vin = 'bjdcbqj'
I want to display the plot for all elements in the list. Example: vin = ['abdd','ncdnjdc','dkqqw']
for item in local_vin:
structs_Final = structs_Full[structs_Full['vin']==item]
a_range = [str(i) for i in
list(MD_Bpressue['BreakPressure(kpa)'].unique())]
brake_count = list(MD_Bpressue.value_y)
BP_colors = len(MDBP_kpa)
#get the required number of colors
BP_mypalette24 = bokeh.palettes.inferno(BP_colors)
brake_count = list(MD_Bpressue.value_y)
BP_colors = len(MDBP_kpa)
#get the required number of colors
BP_mypalette24 = bokeh.palettes.inferno(BP_colors)
BP_colormapper = CategoricalColorMapper(factors=MDBP_kpa,
palette=BP_mypalette24)
BP_sizes = np.linspace(20, 30, len(MDBP_kpa))
# Make the ColumnDataSource: source
BP_source = ColumnDataSource(data={
'x': MDBP_kpa,
'y': brake_count,
'a': a_range
#,'color' : mypalette24
,'size' : BP_sizes
})
# Save the minimum and maximum values of the gdp column: xmin, xmax
BP_xmin, BP_xmax = min(MD_Bpressue.value_x)-10,
max(MD_Bpressue.value_x)+10
#xmin=min(subset.value_km)
# Save the minimum and maximum values of the co2 column: ymin, ymax
BP_ymin, BP_ymax = min(MD_Bpressue.value_y)-50,
max(MD_Bpressue.value_y)+50
# Create the figure: plot
BP_plt = figure(
plot_height=500, plot_width=500,
x_range=(BP_xmin, BP_xmax),
y_range=(BP_ymin, BP_ymax),toolbar_location='right',
title="Manual Compound phases – by service brake pedal (DRIVER)")
# Add circle glyphs to the plot
d = BP_plt.scatter(x='x', y='y', fill_alpha=0.8, source=BP_source,
#legend='x',
color=dict(field='x', transform=BP_colormapper),
size='size'
# Create a HoverTool: hover
BPhover = HoverTool(tooltips=[('kpa','@a'),('brake count','@y')])
# Add the HoverTool to the plot
BP_plt.add_tools(BPhover)
##Format the data to display
md_cols = ['BreakPressure(kpa)','value_y','parameter_id','reading_id','value_x','_index_']
RawData_MDBP=MD_Bpressue[md_cols]
RawData_MDBP=RawData_MDBP.drop(['parameter_id','reading_id','value_x','_index_'],
axis=1)
show(BP_plt)