I want to draw a grid with circles and label each row and column. While I can draw the data points, I fail to properly align the data points and their respective labels, so the plot looks like this:
How can it be done correctly, so that the tick labels align with the datapoints?
The code:
import numpy as np
import itertools
from bokeh.models import Circle, ColumnDataSource
from bokeh.plotting import figure, show
space = 0.5
row_ind = np.arange(0, 2, space)
col_ind = np.arange(0, 1.5, space)
data_points = list(itertools.product(row_ind, col_ind))
rows = [dp[0] for dp in data_points]
cols = [dp[1] for dp in data_points]
size = 10
sizes = [size] * len(data_points)
source = ColumnDataSource(dict(columns=cols, rows=rows, size=sizes))
plot = figure(
plot_width=400,
plot_height=300,
x_range=["1", "2", "3"],
y_range=list("ABCD")
)
plot.circle(
x="columns",
y="rows",
size="size",
line_color="black",
fill_color="white",
line_width=2,
source=source
)
show(plot)

