0

Upon trying to increase the size of a Matplotlib table generated from a csv file, the following code will not work to enlarge the font of the table's text:

plt.rcParams["figure.figsize"] = (8,5.5)

How can I increase the size of the font in Jupyter?

ClaudiaR
  • 3,108
  • 2
  • 13
  • 27
luxstack
  • 9
  • 4

1 Answers1

0

Perhaps something like this?

import matplotlib.pyplot as plt 
   
header = ["header" for i in range(5)] 
values = [["{}".format(c) for c in range(5)] for r in range(5)] 
   
fig, ax = plt.subplots() 
ax.set_axis_off() 
table = ax.table( 
    cellText = values,  
    rowLabels = header,  
    colLabels = header, 
    cellLoc ='center',  
    loc ='upper left')  

# this let you set the font
table.set_fontsize(15)  
# the table doesn't scale with the font, you'll have to enlarge it manually
table.scale(1.5, 1.5)     
   
ax.set_title('Example') 
   
plt.show() 
ClaudiaR
  • 3,108
  • 2
  • 13
  • 27