- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 to change the figsize for matshow() in Jupyter notebook using Matplotlib?
To change the figsize for mathshow, we can use figsize in figure method argument and use fignum in matshow() method.
Steps
- Create a new figure or activate an existing figure using figure() method.
- Create a dataframe using Pandas.
- Use matshow() method to display an array as a matrix in a new figure window.
- The argument fignum can take the values None, int, or False
- If *None*, create a new figure window with automatic numbering.
- If a nonzero integer, draw into the figure with the given number. Create one, if it does not exist.
- If 0, use the current axes (or create one if it does not exist).
- To display the figure, use show() method.
Example
import pandas as pd from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True plt.figure() df = pd.DataFrame({"col1": [1, 3, 5, 7, 1], "col2": [1, 5, 7, 9, 1]}) plt.matshow(df.corr(), fignum=1) plt.show()
Output
- Related Articles
- Hide Matplotlib descriptions in Jupyter notebook
- Using Tkinter in Jupyter Notebook
- Make 3D plot interactive in Jupyter Notebook (Python & Matplotlib)
- How do I omit Matplotlib printed output in Python / Jupyter notebook?
- Programmatically Stop Interaction for specific Figure in Jupyter notebook
- Create a simple Numpy Jupyter Notebook using Docker
- How to display a Dataframe next to a Plot in Jupyter Notebook?
- How to show numpy 2D array as grayscale image in Jupyter Notebook?
- Displaying rotatable 3D plots in IPython or Jupyter Notebook
- How to change the curve using radiobuttons in Matplotlib?
- How to set the matplotlib figure default size in ipython notebook?
- How to change the figuresize using Seaborn factorplot in Matplotlib?
- How to change the default path for "save the figure" in Matplotlib?
- Save figure as file from iPython notebook using Matplotlib
- How to change the datetime tick label frequency for Matplotlib plots?

Advertisements