【问题标题】:How to control cells table alignment on a plot?如何控制绘图上的单元格表格对齐?
【发布时间】:2017-11-16 15:23:49
【问题描述】:

我目前正在尝试使用高斯将单元格表对齐 colWidths:

colWidths 似乎不适用于bbox。 你知道我该怎么做吗?

plt.table(cellText=tableData,
                  rowLabels=rowLabels,
                  colLabels=None,loc='center',colWidths=[0.2]*5,
                  bbox=[0., -0.5,1, 0.3])

【问题讨论】:

    标签: python matplotlib


    【解决方案1】:

    最后,我决定取消绘图的 x 轴。 我没有使用 bbox,我使用 loc='bottom' 将表格粘贴到绘图上。 关于我使用的单元格的大小:cell.set_width

    table_prop = stats_table.properties()
    
    table_cells = table_prop['child_artists']
    for cell in table_cells: 
    
        cell.set_width((z2-z1)/4.4)
        cell.set_linewidth(2) 
    #needed for precision problem between line from the gaussian and line from the border of the cell
    

    这里是结果

    【讨论】:

      猜你喜欢
      • 2013-05-23
      • 2019-06-09
      • 2022-11-28
      • 1970-01-01
      • 1970-01-01
      • 2013-12-08
      • 1970-01-01
      • 2010-12-14
      • 2015-05-21
      相关资源
      最近更新 更多