Minor changes to positioning of objects
- Table is now positioned 'upper center' instead of 'center' - Updated row height and spacings
This commit is contained in:
parent
b0d47dbbe1
commit
3e6e15a3e3
1 changed files with 5 additions and 3 deletions
|
@ -33,7 +33,8 @@ def generate_table(headers, data, title="", bg='skyblue', border='steelblue'):
|
||||||
# with an explicit figsize here can produce better outcome.
|
# with an explicit figsize here can produce better outcome.
|
||||||
|
|
||||||
dpi = 160
|
dpi = 160
|
||||||
image_height = (( 0.9375 + ( 0.40625 * ( len(data) + 1) ) ) * dpi)
|
#image_height = (( 0.5 + ( 0.4125 * ( len(data) + 1) ) ) * dpi)
|
||||||
|
image_height = 100 + (67 * ( len(data) +1 ))
|
||||||
image_width = 6 * dpi
|
image_width = 6 * dpi
|
||||||
|
|
||||||
plt.figure(linewidth=2,
|
plt.figure(linewidth=2,
|
||||||
|
@ -47,8 +48,9 @@ def generate_table(headers, data, title="", bg='skyblue', border='steelblue'):
|
||||||
# Add a table at the bottom of the axes
|
# Add a table at the bottom of the axes
|
||||||
the_table = plt.table(cellText=cell_text,
|
the_table = plt.table(cellText=cell_text,
|
||||||
colLabels=column_headers,
|
colLabels=column_headers,
|
||||||
loc='center')# Scaling is the only influence we have over top and bottom cell padding.
|
loc='upper center')
|
||||||
|
|
||||||
|
# Scaling is the only influence we have over top and bottom cell padding.
|
||||||
# Make the rows taller (i.e., make cell y scale larger).
|
# Make the rows taller (i.e., make cell y scale larger).
|
||||||
the_table.scale(1, 2)
|
the_table.scale(1, 2)
|
||||||
|
|
||||||
|
@ -61,7 +63,7 @@ def generate_table(headers, data, title="", bg='skyblue', border='steelblue'):
|
||||||
plt.box(on=None)
|
plt.box(on=None)
|
||||||
|
|
||||||
# Add title
|
# Add title
|
||||||
plt.suptitle(title_text)
|
plt.suptitle(title_text, x=0.5, y=((image_height - 15)/image_height))
|
||||||
|
|
||||||
# Add footer
|
# Add footer
|
||||||
plt.figtext(((image_width - 15)/image_width), 1-((image_height - 15)/image_height), footer_text, horizontalalignment='right', size=12, weight='light')
|
plt.figtext(((image_width - 15)/image_width), 1-((image_height - 15)/image_height), footer_text, horizontalalignment='right', size=12, weight='light')
|
||||||
|
|
Loading…
Add table
Reference in a new issue