Python Forum

Full Version: Fixed colum width for rowLabels i Matplotlib
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a way to set a min-width or in general width value to the row label cells (r1, r2) in the following code?

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import textwrap as twp
import sys
import json 
import matplotlib as mpl



fig, ax = plt.subplots();


the_table = plt.table(cellText=['c1','c2'],
                      rowLabels=['r1','r2'],
                      bbox=[0, -0.5, 1, 0.5],
                      colLabels= ['col1', 'col2'],
                      loc='bottom')

table_props=the_table.properties()
  
table_cells=the_table.get_celld()
for cell in table_cells:
    print(cell)
    if cell[1] == -1:
       the_table[cell].set_width(3)



Using set_width does not seem to have any effect.