Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matplotlib Row heights table property

I have tried every command and piece of documentation I can find. How do I set the the height of the rows here.

from pylab import *

# Create a figure
fig1 = figure(1)
ax1_1 = fig1.add_subplot(111)

# Add a table with some numbers....

tab = [[1.0000, 3.14159], [1, 2], [2, 1]]

# Format table numbers as string
tab_2 = [['%.2f' % j for j in i] for i in tab]

y_table = plt.table(cellText=tab_2,colLabels=['Col A','Col B'], colWidths = [.5]*2, loc='center')
y_table.set_fontsize(34)


show()
like image 373
user2242044 Avatar asked Jan 15 '15 20:01

user2242044


1 Answers

You could use ytable.scale:

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
tab = [[1.0000, 3.14159], [1, 2], [2, 1]]
tab2 = [['%.2f' % j for j in i] for i in tab]

ytable = plt.table(cellText=tab2, colLabels=['Col A','Col B'], 
                    colWidths=[.5]*2, loc='center')
ytable.set_fontsize(34)
ytable.scale(1, 4)
plt.show()

yields

enter image description here

like image 59
unutbu Avatar answered Nov 15 '22 17:11

unutbu