Skip to content Skip to sidebar Skip to footer

Matplotlib Table Falls Outside Plot Area

I have a table within a plot using Matplotlib and the table spills out past the plot area. Is there a way to make this not happen, perhaps with an offset or something similar? impo

Solution 1:

Add a bbox parameter, in this way you can control the exact location, for example:

plt.table(cellText=table_vals,
                  colWidths = [0.1]*3,
                  rowLabels=row_labels,
                  colLabels=col_labels,
                  loc='center left',
                  bbox=[0.25, -0.5, 0.5, 0.3])

Here is the corresponding documentation for table and the one for bbox.

Post a Comment for "Matplotlib Table Falls Outside Plot Area"