
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 to change the scale of an existing table in Matplotlib?
To change scale of a table, we can use the scale() method. Steps −
Create a figure and a set of subplots, nrows=1 and ncols=1.
Create a random data using numpy.
Make columns value.
Make the axis tight and off.
Initialize a variable fontsize to change the fontsize.
To set the fontsize of the table and to scale the table, we can use 1.5 and 1.5.
To display the figure, use the show() method.
Example
import numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 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') fontsize = 10 the_table = axs.table(cellText=data, colLabels=columns, loc='center') the_table.set_fontsize(fontsize) the_table.scale(1.5, 1.5) plt.show()
Output
- Related Questions & Answers
- Change x axes scale in matplotlib
- How to change the scale of imshow in matplotlib without stretching the image?
- How to change the datatype of a column in an existing table using JDBC API?
- How do I change the font size of the scale in Matplotlib plots?
- How can I change the name of an existing column from a MySQL table?
- How do I change matplotlib's subplot projection of an existing axis?
- How to change the transparency/opaqueness of a Matplotlib Table?
- How to label and change the scale of a Seaborn kdeplot's axes? (Matplotlib)
- How can I see the CREATE TABLE statement of an existing MySQL table?
- How to rename an existing column of a table in PostgreSQL?
- How to add columns to an existing MySQL table?
- Add alpha to an existing Matplotlib colormap
- How to add column to an existing table in PostgreSQL?
- How to exponentially scale the Y axis with matplotlib?
- How to rename a column in an existing MySQL table?
Advertisements