Hey,
I’ve been trying to use bokeh to plot arrays of data with unique colors, but have yet to be successful. Has any one been able to get a working bokeh plot with RGB/RGBA tuples?
Here’s a sample script I was using to plot data. In the matplotlib example I get all the desired colors, but in the bokeh plots they all come out as grey.
import matplotlib.pyplot as plt
import numpy as np
# Import bokeh
import bokeh
import bokeh.plotting
NUM_COLORS = 20
cm = plt.get_cmap('gist_rainbow')
# Define the output file
bokeh.plotting.output_file(filename='quantities.html')
# Define the figure
figure = bokeh.plotting.figure(plot_width=1000, plot_height=600)
# Go through the number of colors
for ix in range(NUM_COLORS):
# color will now be an RGBA tuple
color = cm(1.*ix/NUM_COLORS)
# Define generic data
x = np.arange(0, 10)
y = np.arange(0, 10) + ix
# Plot the data bokeh style
figure.line(x, y, line_color=color, line_width=2, legend=str(ix))
figure.scatter(x, y, color=color)
# Plot the data mpl style
plt.plot(x, y, color=color)
# Show the bokeh plot
bokeh.plotting.show(figure)
# Show the matplotlib plot
plt.show()