python-matplotlibHow to change table column width
import matplotlib.pyplot as plt
data = [[1, 2, 3, 4, 5],
        [10,20,30,40,50],
        [11,21,31,41,51]]
plt.table(data, loc='center', colWidths=[.2,.1,.1,.1,.1])
plt.show()ctrl + c| import matplotlib.pyplot as pltloads Matplotlib module to use plotting capabilities | data =data to use for table cells | 
| .table(plot a table from specified data | loc='center'position table in the middle of the chart area | 
| colWidthsset width of columns based on the list of given values (relative to the chart area, where  | .2set first column width to 20% of chart area | 
| .1set other columns width to 10% of chart area | |
Usage example
import matplotlib.pyplot as plt
data = [[1, 2, 3, 4, 5],
        [10,20,30,40,50],
        [11,21,31,41,51]]
plt.table(data, loc='center', colWidths=[.2,.1,.1,.1,.1])
plt.show()More of Python Matplotlib
- Errorbar usage example
- How to export to jpeg
- How to draw a circle with no fill
- How to customize histogram bins
- How to plot specific country from world map
- How to change boxplot colors
- How to plot 3D heatmap
- How to change histogram bins number
- How to add legend to boxplot
- How to plot array
See more codes...
