Closed
Description
Bug report
No way to change the fontsize of tables (matplotlib.pyplot.table )
Bug summary
The kwarg fontsize for matplotlib.pyplot.table does not set the fontsize, nor does looping through each cell and setting cell's fontsize.
Code for reproduction
#import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
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]]
columns = ('Freeze', 'Wind', 'Flood', 'Quake', 'Hail')
rows = ['%d year' % x for x in (100, 50, 20, 10, 5)]
values = np.arange(0, 2500, 500)
value_increment = 1000
# Get some pastel shades for the colors
colors = plt.cm.BuPu(np.linspace(0, 0.5, len(rows)))
n_rows = len(data)
index = np.arange(len(columns)) + 0.3
bar_width = 0.4
# Initialize the vertical-offset for the stacked bar chart.
y_offset = np.zeros(len(columns))
# Plot bars and create text labels for the table
cell_text = []
for row in range(n_rows):
plt.bar(index, data[row], bar_width, bottom=y_offset, color=colors[row])
y_offset = y_offset + data[row]
cell_text.append(['%1.1f' % (x / 1000.0) for x in y_offset])
# Add a table at the bottom of the axes
the_table = plt.table(cellText=cell_text,
rowLabels=rows,
rowColours=colors,
colLabels=columns,
loc='bottom',
**fontsize = 30)**
# Adjust layout to make room for the table:
plt.subplots_adjust(left=0.2, bottom=.1)
plt.show()
<img width="518" alt="screen shot 2018-11-18 at 4 40 09 am" src="https://user-images.githubusercontent.com/10767779/48671898-10cf4280-eaec-11e8-94ba-19ef31681855.png">
Actual outcome
Expected outcome
The font in the table should be much biggerMatplotlib version
- Operating system: OSX 10.13.6
- Matplotlib version:
- Matplotlib backend (
print(matplotlib.get_backend())
): module://ipykernel.pylab.backend_inline - Python version: 3.6x
- Jupyter version (if applicable):
- Other libraries: