- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do I plot only a table in Matplotlib?
To plot only a table, we can take the following steps−
- Create fig and axs, using subplots. Create a figure and a set of subplots.
- Create random data for 10 rows and 3 columns.
- Create a tuple for columns name.
- axis('tight') − Set the limits, just large enough to show all the data, then disable further autoscaling.
- axis('off') − Turn off axis lines and labels. Same as ''False''.
- To add a table on the axis, use table() instance, with column text, column labels, columns, and location=center.
- To display the figure, use show() method.
Example
import numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True fig, axs = plt.subplots(1, 1) data = np.random.random((10, 3)) columns = ("Column I", "Column II", "Column III") axs.axis('tight') axs.axis('off') the_table = axs.table(cellText=data, colLabels=columns, loc='center') plt.show()
Output
- Related Articles
- How can I place a table on a plot in Matplotlib?
- How do I plot a step function with Matplotlib in Python?
- How do I plot multiple X or Y axes in Matplotlib?
- How do I plot Shapely polygons and objects using Matplotlib?
- How do I plot hatched bars using Pandas and Matplotlib?
- How do I let my Matplotlib plot go beyond the axes?
- How can I plot a confusion matrix in matplotlib?
- How do I fill a region with only hatch (no background colour) in matplotlib 2.0?
- How do I change the axis tick font in a Matplotlib plot when rendering using LaTeX?
- How do I plot two countplot graphs side by side in Seaborn using Matplotlib?
- How can I plot a single point in Matplotlib Python?
- How can I plot hysteresis threshold in Matplotlib?
- How do I plot a spectrogram the same way that pylab's specgram() does? (Matplotlib)
- How do you create a legend for a contour plot in Matplotlib?
- How do I write a Latex formula in the legend of a plot using Matplotlib inside a .py file?

Advertisements