I have a problem building a matrix with pokon bokeh and glyphs.
I am new to Bokeh and just adapted the code I found on the Internet.
Everything seems to be in order, but there is an offset when starting the function.

And I would like to:

The code is: please tell me something is wrong.
def disp(dom,matrixs) :
cols = [] #rome colones
rows = [] #rome lignes
libcol = [] #libelle métiers
librow = []
color = [] #couleurs
rate = [] #%age de compétences déjà validées
mank = [] #liste des compétences manquantes
nbmank = [] #nb de compétences manquantes
nbtot = []
for i in matrixs[dom].columns:
for j in matrixs[dom].columns:
rows.append(i)
cols.append(j)
libcol.append(compbyrome[j]['label'])
librow.append(compbyrome[i]['label'])
rateval = matrixs[dom][i][j]
nbmank.append(len(compbyrome[j]['competences'])-(rateval*len(compbyrome[j]['competences'])/100))
nbtot.append(len(compbyrome[j]['competences']))
rate.append(rateval)
if rateval < 20:
col = 0
elif rateval >= 20 and rateval < 40:
col = 1
elif rateval >= 40 and rateval < 60:
col = 2
elif rateval >= 60 and rateval < 80:
col = 3
else :
col = 4
color.append(colors[col])
TOOLS = "hover,save,pan"
source = ColumnDataSource(
data = dict(
rows=rows,
cols=cols,
librow=librow,
libcol=libcol,
color=color,
rate=rate,
nbmank=nbmank,
nbtot=nbtot)
)
if (len(matrixs[dom].columns)) <= 8 :
taille = 800
elif (len(matrixs[dom].columns)) >= 15:
taille = 1000
else:
taille = len(matrixs[dom].columns)*110
p = figure(
title=str(dom),
x_range=list(reversed(librow)),
y_range=librow,
x_axis_location="above",
plot_width=taille,
plot_height=taille,
toolbar_location="left",
tools=TOOLS
)
p.rect("librow", "libcol", len(matrixs[dom].columns)-1, len(matrixs[dom].columns)-1, source=source,
color="color", line_color=None)
p.grid.grid_line_color = None
p.axis.axis_line_color = None
p.axis.major_tick_line_color = None
p.axis.major_label_text_font_size = "10pt"
p.axis.major_label_standoff = 0
p.xaxis.major_label_orientation = np.pi/3
hover = p.select(dict(type=HoverTool))
hover.tooltips = """
<div>
provenance = @rows (@librow)
</div>
<div>
évolution = @cols (@libcol)
</div>
<div>
compétences déjà acquises = @rate %
</div>
<div>
nbmanquantes = @nbmank
</div>
<div>
nbtot = @nbtot
</div>
"""
show(p)
I get the data from the matrix matrix, as you can see, but I think the problem has nothing to do with the data.
source
share