Hey guys,
I try to plot a ColumnDataSource and set the legend names to the name of the data column, however this fails:
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure, show, output_file
from bokeh.layouts import row
import pandas as pd
df = pd.DataFrame(data=None,index = range(0,100))
df['DATA_A'] = 0
df['DATA_B'] = 1
CDS= ColumnDataSource(df)
p1 = figure()
p1.line(x='index', y='DATA_A', source=CDS,line_color='green',legend='bla A')
p1.line(x='index', y='DATA_B', source=CDS,line_color='blue',legend='bla B')
p2 = figure()
p2.line(x='index', y='DATA_A', source=CDS,line_color='green',legend='DATA_A')
p2.line(x='index', y='DATA_B', source=CDS,line_color='blue',legend='DATA_B')
output_file("legend.html")
show(row(p1,p2))
p1 shows the correct legend entries, p2 does not! I assume this is because ‘DATA_A’ and ‘DATA_B’ are column names of CDS.
So how can I set the legend to the column names of CDS?
Thanks for your help!

