Centered text in matplotlib tables

后端 未结 3 1687
故里飘歌
故里飘歌 2021-01-17 23:02

I am trying to center the text inside a matplotlib table cell, while the default seems to be right aligned. I looked through the documentation of the Table object, but I cou

3条回答
  •  Happy的楠姐
    2021-01-17 23:49

    Try editing the sample here

    Adding

    cellLoc='center'
    

    To

    the_table = plt.table(cellText=cell_text,
                          rowLabels=rows,
                          rowColours=colors,
                          colLabels=columns,
                          loc='bottom')
    

    To get enter image description here

提交回复
热议问题