
I am trying to adapt an old code to a new version of Bokeh. The original one, published in Python for Bioinformatics is like this:
from bokeh.charts import Scatter, output_file, show
from pandas import DataFrame
df = DataFrame.from_csv('../../samples/fishdata.csv')
scatter = Scatter(df, x='PC1', y='PC2', color='feeds',
marker='species', title=
'Metabolic variations based on 1H NMR profiling of fishes',
xlabel='Principal Component 1: 35.8%',
ylabel='Principal Component 2: 15.1%')
scatter.legend.background_fill_alpha = 0.3
output_file('scatter.html')
show(scatter)
That produces the following plot:
[External image unavailable in archive]
Since bokeh.charts is deprecated, I had to modify the code to get the same result, here is the new code:
That produces a similar plot:
I wonder how to put a legend with both fields, as in the original image. Legend accepts only a string with the name one field, but I need to enter two. What can I do?




