Python matplotlib.pyplot.table() Examples
The following are 26
code examples of matplotlib.pyplot.table().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib.pyplot
, or try the search function
.
Example #1
Source File: mantra.py From mantra with Apache License 2.0 | 5 votes |
def generate_tabular_sample(cls, dataset_name, dataset_class, data_location, sample_location): """ Generates a jpg from a sample of the pandas DataFrame """ extract_loc = '%sraw/%s' % (data_location, 'sample_extract') file_to_extract = dataset_class.data_file _ = cls.extract_data_files(dataset_name, dataset_class, data_location, sample_location, extract_loc, None) # define the core DataFrames file_type = file_to_extract.split('.')[-1] if file_type == 'csv': df = pd.read_csv('%s/%s' % ('%s%s' % (data_location, 'raw/sample_extract'), file_to_extract)).head() else: df = pd.DataFrame() plt.figure() cell_text = [] for row in range(len(df)): cell_text.append(df.iloc[row, :3]) plt.table(cellText=cell_text, colLabels=df.columns[:3], loc='center') plt.axis('off') plt.savefig(sample_location) shutil.rmtree(extract_loc)
Example #2
Source File: test_bbox_tight.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_bbox_inches_tight(): #: Test that a figure saved using bbox_inches='tight' is clipped correctly data = [[66386, 174296, 75131, 577908, 32015], [58230, 381139, 78045, 99308, 160454], [89135, 80552, 152558, 497981, 603535], [78415, 81858, 150656, 193263, 69638], [139361, 331509, 343164, 781380, 52269]] colLabels = rowLabels = [''] * 5 rows = len(data) ind = np.arange(len(colLabels)) + 0.3 # the x locations for the groups cellText = [] width = 0.4 # the width of the bars yoff = np.zeros(len(colLabels)) # the bottom values for stacked bar chart fig, ax = plt.subplots(1, 1) for row in range(rows): ax.bar(ind, data[row], width, bottom=yoff, color='b') yoff = yoff + data[row] cellText.append(['']) plt.xticks([]) plt.legend([''] * 5, loc=(1.2, 0.2)) # Add a table at the bottom of the axes cellText.reverse() the_table = plt.table(cellText=cellText, rowLabels=rowLabels, colLabels=colLabels, loc='bottom')
Example #3
Source File: test_table.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_diff_cell_table(): cells = ('horizontal', 'vertical', 'open', 'closed', 'T', 'R', 'B', 'L') cellText = [['1'] * len(cells)] * 2 colWidths = [0.1] * len(cells) _, axes = plt.subplots(nrows=len(cells), figsize=(4, len(cells)+1)) for ax, cell in zip(axes, cells): ax.table( colWidths=colWidths, cellText=cellText, loc='center', edges=cell, ) ax.axis('off') plt.tight_layout()
Example #4
Source File: test_table.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_label_colours(): dim = 3 c = np.linspace(0, 1, dim) colours = plt.cm.RdYlGn(c) cellText = [['1'] * dim] * dim fig = plt.figure() ax1 = fig.add_subplot(4, 1, 1) ax1.axis('off') ax1.table(cellText=cellText, rowColours=colours, loc='best') ax2 = fig.add_subplot(4, 1, 2) ax2.axis('off') ax2.table(cellText=cellText, rowColours=colours, rowLabels=['Header'] * dim, loc='best') ax3 = fig.add_subplot(4, 1, 3) ax3.axis('off') ax3.table(cellText=cellText, colColours=colours, loc='best') ax4 = fig.add_subplot(4, 1, 4) ax4.axis('off') ax4.table(cellText=cellText, colColours=colours, colLabels=['Header'] * dim, loc='best')
Example #5
Source File: test_table.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_zorder(): data = [[66386, 174296], [58230, 381139]] colLabels = ('Freeze', 'Wind') rowLabels = ['%d year' % x for x in (100, 50)] cellText = [] yoff = np.zeros(len(colLabels)) for row in reversed(data): yoff += row cellText.append(['%1.1f' % (x/1000.0) for x in yoff]) t = np.linspace(0, 2*np.pi, 100) plt.plot(t, np.cos(t), lw=4, zorder=2) plt.table(cellText=cellText, rowLabels=rowLabels, colLabels=colLabels, loc='center', zorder=-2, ) plt.table(cellText=cellText, rowLabels=rowLabels, colLabels=colLabels, loc='upper center', zorder=4, ) plt.yticks([])
Example #6
Source File: test_table.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_non_square(): # Check that creating a non-square table works cellcolors = ['b', 'r'] plt.table(cellColours=cellcolors)
Example #7
Source File: test_bbox_tight.py From coffeegrindsize with MIT License | 5 votes |
def test_bbox_inches_tight(): #: Test that a figure saved using bbox_inches='tight' is clipped correctly data = [[66386, 174296, 75131, 577908, 32015], [58230, 381139, 78045, 99308, 160454], [89135, 80552, 152558, 497981, 603535], [78415, 81858, 150656, 193263, 69638], [139361, 331509, 343164, 781380, 52269]] colLabels = rowLabels = [''] * 5 rows = len(data) ind = np.arange(len(colLabels)) + 0.3 # the x locations for the groups cellText = [] width = 0.4 # the width of the bars yoff = np.zeros(len(colLabels)) # the bottom values for stacked bar chart fig, ax = plt.subplots(1, 1) for row in range(rows): ax.bar(ind, data[row], width, bottom=yoff, align='edge', color='b') yoff = yoff + data[row] cellText.append(['']) plt.xticks([]) plt.legend([''] * 5, loc=(1.2, 0.2)) # Add a table at the bottom of the axes cellText.reverse() the_table = plt.table(cellText=cellText, rowLabels=rowLabels, colLabels=colLabels, loc='bottom')
Example #8
Source File: test_table.py From coffeegrindsize with MIT License | 5 votes |
def test_diff_cell_table(): cells = ('horizontal', 'vertical', 'open', 'closed', 'T', 'R', 'B', 'L') cellText = [['1'] * len(cells)] * 2 colWidths = [0.1] * len(cells) _, axes = plt.subplots(nrows=len(cells), figsize=(4, len(cells)+1)) for ax, cell in zip(axes, cells): ax.table( colWidths=colWidths, cellText=cellText, loc='center', edges=cell, ) ax.axis('off') plt.tight_layout()
Example #9
Source File: test_table.py From coffeegrindsize with MIT License | 5 votes |
def test_label_colours(): dim = 3 c = np.linspace(0, 1, dim) colours = plt.cm.RdYlGn(c) cellText = [['1'] * dim] * dim fig = plt.figure() ax1 = fig.add_subplot(4, 1, 1) ax1.axis('off') ax1.table(cellText=cellText, rowColours=colours, loc='best') ax2 = fig.add_subplot(4, 1, 2) ax2.axis('off') ax2.table(cellText=cellText, rowColours=colours, rowLabels=['Header'] * dim, loc='best') ax3 = fig.add_subplot(4, 1, 3) ax3.axis('off') ax3.table(cellText=cellText, colColours=colours, loc='best') ax4 = fig.add_subplot(4, 1, 4) ax4.axis('off') ax4.table(cellText=cellText, colColours=colours, colLabels=['Header'] * dim, loc='best')
Example #10
Source File: test_table.py From coffeegrindsize with MIT License | 5 votes |
def test_zorder(): data = [[66386, 174296], [58230, 381139]] colLabels = ('Freeze', 'Wind') rowLabels = ['%d year' % x for x in (100, 50)] cellText = [] yoff = np.zeros(len(colLabels)) for row in reversed(data): yoff += row cellText.append(['%1.1f' % (x/1000.0) for x in yoff]) t = np.linspace(0, 2*np.pi, 100) plt.plot(t, np.cos(t), lw=4, zorder=2) plt.table(cellText=cellText, rowLabels=rowLabels, colLabels=colLabels, loc='center', zorder=-2, ) plt.table(cellText=cellText, rowLabels=rowLabels, colLabels=colLabels, loc='upper center', zorder=4, ) plt.yticks([])
Example #11
Source File: test_table.py From coffeegrindsize with MIT License | 5 votes |
def test_non_square(): # Check that creating a non-square table works cellcolors = ['b', 'r'] plt.table(cellColours=cellcolors)
Example #12
Source File: car_rental_synchronous.py From reinforcement-learning-an-introduction with MIT License | 5 votes |
def plot(self): print(self.policy) plt.figure() plt.xlim(0, MAX_CARS + 1) plt.ylim(0, MAX_CARS + 1) plt.table(cellText=np.flipud(self.policy), loc=(0, 0), cellLoc='center') plt.show()
Example #13
Source File: test_bbox_tight.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_bbox_inches_tight(): #: Test that a figure saved using bbox_inches='tight' is clipped correctly data = [[66386, 174296, 75131, 577908, 32015], [58230, 381139, 78045, 99308, 160454], [89135, 80552, 152558, 497981, 603535], [78415, 81858, 150656, 193263, 69638], [139361, 331509, 343164, 781380, 52269]] colLabels = rowLabels = [''] * 5 rows = len(data) ind = np.arange(len(colLabels)) + 0.3 # the x locations for the groups cellText = [] width = 0.4 # the width of the bars yoff = np.zeros(len(colLabels)) # the bottom values for stacked bar chart fig, ax = plt.subplots(1, 1) for row in range(rows): ax.bar(ind, data[row], width, bottom=yoff, align='edge', color='b') yoff = yoff + data[row] cellText.append(['']) plt.xticks([]) plt.legend([''] * 5, loc=(1.2, 0.2)) # Add a table at the bottom of the axes cellText.reverse() the_table = plt.table(cellText=cellText, rowLabels=rowLabels, colLabels=colLabels, loc='bottom')
Example #14
Source File: test_table.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_diff_cell_table(): cells = ('horizontal', 'vertical', 'open', 'closed', 'T', 'R', 'B', 'L') cellText = [['1'] * len(cells)] * 2 colWidths = [0.1] * len(cells) _, axes = plt.subplots(nrows=len(cells), figsize=(4, len(cells)+1)) for ax, cell in zip(axes, cells): ax.table( colWidths=colWidths, cellText=cellText, loc='center', edges=cell, ) ax.axis('off') plt.tight_layout()
Example #15
Source File: test_table.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_label_colours(): dim = 3 c = np.linspace(0, 1, dim) colours = plt.cm.RdYlGn(c) cellText = [['1'] * dim] * dim fig = plt.figure() ax1 = fig.add_subplot(4, 1, 1) ax1.axis('off') ax1.table(cellText=cellText, rowColours=colours, loc='best') ax2 = fig.add_subplot(4, 1, 2) ax2.axis('off') ax2.table(cellText=cellText, rowColours=colours, rowLabels=['Header'] * dim, loc='best') ax3 = fig.add_subplot(4, 1, 3) ax3.axis('off') ax3.table(cellText=cellText, colColours=colours, loc='best') ax4 = fig.add_subplot(4, 1, 4) ax4.axis('off') ax4.table(cellText=cellText, colColours=colours, colLabels=['Header'] * dim, loc='best')
Example #16
Source File: test_table.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_zorder(): data = [[66386, 174296], [58230, 381139]] colLabels = ('Freeze', 'Wind') rowLabels = ['%d year' % x for x in (100, 50)] cellText = [] yoff = np.zeros(len(colLabels)) for row in reversed(data): yoff += row cellText.append(['%1.1f' % (x/1000.0) for x in yoff]) t = np.linspace(0, 2*np.pi, 100) plt.plot(t, np.cos(t), lw=4, zorder=2) plt.table(cellText=cellText, rowLabels=rowLabels, colLabels=colLabels, loc='center', zorder=-2, ) plt.table(cellText=cellText, rowLabels=rowLabels, colLabels=colLabels, loc='upper center', zorder=4, ) plt.yticks([])
Example #17
Source File: test_table.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_non_square(): # Check that creating a non-square table works cellcolors = ['b', 'r'] plt.table(cellColours=cellcolors)
Example #18
Source File: darts_utils.py From FasterSeg with MIT License | 5 votes |
def plot_op(ops, path, width=[], head_width=None, F_base=16): assert len(width) == 0 or len(width) == len(ops) - 1 table_vals = [] scales = {0: "1/8", 1: "1/16", 2: "1/32"}; base_scale = 3 for idx, op in enumerate(ops): scale = path[idx] if len(width) > 0: if idx < len(width): ch = int(F_base*2**(scale+base_scale)*width[idx]) else: ch = int(F_base*2**(scale+base_scale)*head_width) else: ch = F_base*2**(scale+base_scale) row = [idx+1, PRIMITIVES[op], scales[scale], ch] table_vals.append(row) # Based on http://stackoverflow.com/a/8531491/190597 (Andrey Sobolev) col_labels = ['Stage', 'Operator', 'Scale', '#Channel_out'] plt.tight_layout() fig = plt.figure(figsize=(3,3)) ax = fig.add_subplot(111, frame_on=False) ax.xaxis.set_visible(False) # hide the x axis ax.yaxis.set_visible(False) # hide the y axis table = plt.table(cellText=table_vals, colWidths=[0.22, 0.6, 0.25, 0.5], colLabels=col_labels, cellLoc='center', loc='center') table.auto_set_font_size(False) table.set_fontsize(20) table.scale(2, 2) return fig
Example #19
Source File: test_bbox_tight.py From neural-network-animation with MIT License | 5 votes |
def test_bbox_inches_tight(): #: Test that a figure saved using bbox_inches='tight' is clipped correctly data = [[ 66386, 174296, 75131, 577908, 32015], [ 58230, 381139, 78045, 99308, 160454], [ 89135, 80552, 152558, 497981, 603535], [ 78415, 81858, 150656, 193263, 69638], [139361, 331509, 343164, 781380, 52269]] colLabels = rowLabels = [''] * 5 rows = len(data) ind = np.arange(len(colLabels)) + 0.3 # the x locations for the groups cellText = [] width = 0.4 # the width of the bars yoff = np.array([0.0] * len(colLabels)) # the bottom values for stacked bar chart fig, ax = plt.subplots(1, 1) for row in xrange(rows): plt.bar(ind, data[row], width, bottom=yoff) yoff = yoff + data[row] cellText.append(['']) plt.xticks([]) plt.legend([''] * 5, loc=(1.2, 0.2)) # Add a table at the bottom of the axes cellText.reverse() the_table = plt.table(cellText=cellText, rowLabels=rowLabels, colLabels=colLabels, loc='bottom')
Example #20
Source File: test_table.py From neural-network-animation with MIT License | 5 votes |
def test_label_colours(): dim = 3 c = np.linspace(0, 1, dim) colours = plt.cm.RdYlGn(c) cellText = [['1'] * dim] * dim fig = plt.figure() ax1 = fig.add_subplot(4, 1, 1) ax1.axis('off') ax1.table(cellText=cellText, rowColours=colours, loc='best') ax2 = fig.add_subplot(4, 1, 2) ax2.axis('off') ax2.table(cellText=cellText, rowColours=colours, rowLabels=['Header'] * dim, loc='best') ax3 = fig.add_subplot(4, 1, 3) ax3.axis('off') ax3.table(cellText=cellText, colColours=colours, loc='best') ax4 = fig.add_subplot(4, 1, 4) ax4.axis('off') ax4.table(cellText=cellText, colColours=colours, colLabels=['Header'] * dim, loc='best')
Example #21
Source File: test_table.py From neural-network-animation with MIT License | 5 votes |
def test_zorder(): data = [[66386, 174296], [58230, 381139]] colLabels = ('Freeze', 'Wind') rowLabels = ['%d year' % x for x in (100, 50)] cellText = [] yoff = np.array([0.0] * len(colLabels)) for row in reversed(data): yoff += row cellText.append(['%1.1f' % (x/1000.0) for x in yoff]) t = np.linspace(0, 2*np.pi, 100) plt.plot(t, np.cos(t), lw=4, zorder=2) plt.table(cellText=cellText, rowLabels=rowLabels, colLabels=colLabels, loc='center', zorder=-2, ) plt.table(cellText=cellText, rowLabels=rowLabels, colLabels=colLabels, loc='upper center', zorder=4, ) plt.yticks([])
Example #22
Source File: benchmark.py From Airtest with Apache License 2.0 | 5 votes |
def plot_compare_table(image_list, method_list, color_list, compare_dict, fig_name="", fig_num=111): """绘制了对比表格.""" row_labels = image_list # 写入值: table_vals = [] for i in range(len(row_labels)): row_vals = [] for method in method_list: row_vals.append(compare_dict[method][i]) table_vals.append(row_vals) # 绘制表格图 colors = [[(0.95, 0.95, 0.95) for c in range(len(method_list))] for r in range(len(row_labels))] # cell的颜色 # plt.figure(figsize=(8, 4), dpi=120) plt.subplot(fig_num) plt.title(fig_name) # 绘制标题 lightgrn = (0.5, 0.8, 0.5) # 这个是label的背景色 plt.table(cellText=table_vals, rowLabels=row_labels, colLabels=method_list, rowColours=[lightgrn] * len(row_labels), colColours=color_list, cellColours=colors, cellLoc='center', loc='upper left') plt.axis('off') # 关闭坐标轴
Example #23
Source File: mturk_depth_api_human.py From rel_3d_pose with MIT License | 4 votes |
def plotHITStatus( savePath = '/home/ubuntu/amt_guis/cocoa_depth/plots/', filename = 'time_info' ): pdf = PdfPages( savePath + filename + '.pdf') fig = plt.figure() plt.clf() page_size = 100 ass_time_info_list = [] mtc = MTurkConnection( host = _host ) assignments = getReviewableAssignments() for ass in assignments: time_info = \ {'AcceptTime':ass.AcceptTime, 'SubmitTime':ass.SubmitTime, 'ExecutionTime': [ question_form_answer.fields[0] for question_form_answer in ass.answers[0] if question_form_answer.qid == '_hit_rt' ][0] } ass_time_info_list.append( time_info ) ass_time_info_list.sort(key=lambda x: datetime.datetime.strptime(x['AcceptTime'],'%Y-%m-%dT%H:%M:%SZ')) first_assignment = ass_time_info_list[0] ass_time_info_list.sort(key=lambda x: datetime.datetime.strptime(x['SubmitTime'],'%Y-%m-%dT%H:%M:%SZ')) last_assignment = ass_time_info_list[-1] time_since_beginning = int(( datetime.datetime.strptime(last_assignment['SubmitTime'],'%Y-%m-%dT%H:%M:%SZ') - datetime.datetime.strptime(first_assignment['AcceptTime'],'%Y-%m-%dT%H:%M:%SZ')).total_seconds()) completed_percentage = [] # time since beginning in one hour intervals time_range = range( 0, time_since_beginning + 3600, 3600 ) for s in time_range: currently_completed = \ [x for x in ass_time_info_list if datetime.datetime.strptime(x['SubmitTime'],'%Y-%m-%dT%H:%M:%SZ') < datetime.timedelta(seconds=s) + datetime.datetime.strptime(first_assignment['SubmitTime'],'%Y-%m-%dT%H:%M:%SZ')] perc = len( currently_completed ) / float( NUMBER_HITS * NUMBER_HIT_ASSIGNMENTS ) completed_percentage.append( perc ) per_hour_completion_rate = len(ass_time_info_list) / float(time_since_beginning / 3600) #print per_hour_completion_rate hours_to_completion = ((NUMBER_HITS * NUMBER_HIT_ASSIGNMENTS) - len(ass_time_info_list)) / per_hour_completion_rate #print hours_to_completion plt.plot( time_range, completed_percentage ) rows = ['Completed Assignments','Total Assignments','Hour Completion Rate','Hours to Completion'] data = [["%d"%(len(ass_time_info_list))],["%d"%(NUMBER_HITS * NUMBER_HIT_ASSIGNMENTS)],["%.2f" % per_hour_completion_rate],["%.2f" % hours_to_completion]] plt.table(cellText=data,rowLabels=rows,loc='center',colWidths = [0.1]*3) plt.title('Per hour completion percentage') plt.xticks( time_range[0::10], [str(x/3600) for x in time_range[0::10]] ) plt.yticks([0,0.2,0.4,0.6,0.8,1],['0%', '20%','40%','60%','80%','100%']) plt.ylabel('Completion Percentage') plt.xlabel('Hours since beginning of task') plt.grid() pdf.savefig() pdf.close() plt.close()
Example #24
Source File: test_table.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 4 votes |
def test_auto_column(): fig = plt.figure() # iterable list input ax1 = fig.add_subplot(4, 1, 1) ax1.axis('off') tb1 = ax1.table(cellText=[['Fit Text', 2], ['very long long text, Longer text than default', 1]], rowLabels=["A", "B"], colLabels=["Col1", "Col2"], loc="center") tb1.auto_set_font_size(False) tb1.set_fontsize(12) tb1.auto_set_column_width([-1, 0, 1]) # iterable tuple input ax2 = fig.add_subplot(4, 1, 2) ax2.axis('off') tb2 = ax2.table(cellText=[['Fit Text', 2], ['very long long text, Longer text than default', 1]], rowLabels=["A", "B"], colLabels=["Col1", "Col2"], loc="center") tb2.auto_set_font_size(False) tb2.set_fontsize(12) tb2.auto_set_column_width((-1, 0, 1)) #3 single inputs ax3 = fig.add_subplot(4, 1, 3) ax3.axis('off') tb3 = ax3.table(cellText=[['Fit Text', 2], ['very long long text, Longer text than default', 1]], rowLabels=["A", "B"], colLabels=["Col1", "Col2"], loc="center") tb3.auto_set_font_size(False) tb3.set_fontsize(12) tb3.auto_set_column_width(-1) tb3.auto_set_column_width(0) tb3.auto_set_column_width(1) #4 non integer interable input ax4 = fig.add_subplot(4, 1, 4) ax4.axis('off') tb4 = ax4.table(cellText=[['Fit Text', 2], ['very long long text, Longer text than default', 1]], rowLabels=["A", "B"], colLabels=["Col1", "Col2"], loc="center") tb4.auto_set_font_size(False) tb4.set_fontsize(12) tb4.auto_set_column_width("-101")
Example #25
Source File: test_table.py From coffeegrindsize with MIT License | 4 votes |
def test_auto_column(): fig = plt.figure() # iterable list input ax1 = fig.add_subplot(4, 1, 1) ax1.axis('off') tb1 = ax1.table(cellText=[['Fit Text', 2], ['very long long text, Longer text than default', 1]], rowLabels=["A", "B"], colLabels=["Col1", "Col2"], loc="center") tb1.auto_set_font_size(False) tb1.set_fontsize(12) tb1.auto_set_column_width([-1, 0, 1]) # iterable tuple input ax2 = fig.add_subplot(4, 1, 2) ax2.axis('off') tb2 = ax2.table(cellText=[['Fit Text', 2], ['very long long text, Longer text than default', 1]], rowLabels=["A", "B"], colLabels=["Col1", "Col2"], loc="center") tb2.auto_set_font_size(False) tb2.set_fontsize(12) tb2.auto_set_column_width((-1, 0, 1)) #3 single inputs ax3 = fig.add_subplot(4, 1, 3) ax3.axis('off') tb3 = ax3.table(cellText=[['Fit Text', 2], ['very long long text, Longer text than default', 1]], rowLabels=["A", "B"], colLabels=["Col1", "Col2"], loc="center") tb3.auto_set_font_size(False) tb3.set_fontsize(12) tb3.auto_set_column_width(-1) tb3.auto_set_column_width(0) tb3.auto_set_column_width(1) #4 non integer interable input ax4 = fig.add_subplot(4, 1, 4) ax4.axis('off') tb4 = ax4.table(cellText=[['Fit Text', 2], ['very long long text, Longer text than default', 1]], rowLabels=["A", "B"], colLabels=["Col1", "Col2"], loc="center") tb4.auto_set_font_size(False) tb4.set_fontsize(12) tb4.auto_set_column_width("-101")
Example #26
Source File: test_table.py From twitter-stock-recommendation with MIT License | 4 votes |
def test_auto_column(): fig = plt.figure() # iterable list input ax1 = fig.add_subplot(4, 1, 1) ax1.axis('off') tb1 = ax1.table(cellText=[['Fit Text', 2], ['very long long text, Longer text than default', 1]], rowLabels=["A", "B"], colLabels=["Col1", "Col2"], loc="center") tb1.auto_set_font_size(False) tb1.set_fontsize(12) tb1.auto_set_column_width([-1, 0, 1]) # iterable tuple input ax2 = fig.add_subplot(4, 1, 2) ax2.axis('off') tb2 = ax2.table(cellText=[['Fit Text', 2], ['very long long text, Longer text than default', 1]], rowLabels=["A", "B"], colLabels=["Col1", "Col2"], loc="center") tb2.auto_set_font_size(False) tb2.set_fontsize(12) tb2.auto_set_column_width((-1, 0, 1)) #3 single inputs ax3 = fig.add_subplot(4, 1, 3) ax3.axis('off') tb3 = ax3.table(cellText=[['Fit Text', 2], ['very long long text, Longer text than default', 1]], rowLabels=["A", "B"], colLabels=["Col1", "Col2"], loc="center") tb3.auto_set_font_size(False) tb3.set_fontsize(12) tb3.auto_set_column_width(-1) tb3.auto_set_column_width(0) tb3.auto_set_column_width(1) #4 non integer interable input ax4 = fig.add_subplot(4, 1, 4) ax4.axis('off') tb4 = ax4.table(cellText=[['Fit Text', 2], ['very long long text, Longer text than default', 1]], rowLabels=["A", "B"], colLabels=["Col1", "Col2"], loc="center") tb4.auto_set_font_size(False) tb4.set_fontsize(12) tb4.auto_set_column_width("-101")