def drawMolsByLabel(topicModel, label, idLabelToMatch=0, baseRad=0.5, molSize=(250,150),\
numRowsShown=3, tableHeader='', maxMols=100):
result = generateMoleculeSVGsbyLabel(topicModel, label, idLabelToMatch=idLabelToMatch,baseRad=baseRad,\
molSize=molSize, maxMols=maxMols)
if len(result) == 1:
print(result)
return
svgs, namesSVGs = result
finalsvgs = []
for svg in svgs:
# make the svg scalable
finalsvgs.append(svg.replace('<svg','<svg preserveAspectRatio="xMinYMin meet" viewBox="0 0 '+str(molSize[0])\
+' '+str(molSize[1])+'"'))
return display(HTML(utilsDrawing.drawSVGsToHTMLGrid(finalsvgs[:maxMols],cssTableName='overviewTab',tableHeader='Molecules of '+str(label),
namesSVGs=namesSVGs[:maxMols], size=molSize, numRowsShown=numRowsShown, numColumns=4)))
# produces a svg grid of the molecules of a certain label and highlights the most probable topic
评论列表
文章目录