Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. It was introduced by John Hunter in the year 2002.
matplotlib.pyplot.matshow() function is used to represent an array as a matrix in a new figure window. the upper left-hand corner is set as the origin and the rows (first dimension of the array) are displayed in a horizontal form. The aspect ratio of the figure window is set according to the array to avoid short and narrow figures. The x-axis Tick labels are placed at the top.
Syntax: matplotlib.pyplot.matshow(A, fignum=None, **kwargs)
- A:: It is an array like object that represents the matrix. It is a required parameter.
- fignum: It accepts three values namely ‘None’, ‘False’ or an integer value. If the value is set to None it would create a new window of the figure with automated numbering. If the value is a non-zero integer then it is drawn into the figure respective to the given number or it creates it if it doesn’t exist. If the ‘0’ is set as the value of this parameter then it uses the current axes or it creates one if it doesn’t exist.
Returns: It returns an image of Axesimage class.
Other parameters: It aslo accepts the imshow argument for showing image.
- Reusable piece of python functionality for wrapping arbitrary blocks of code : Python Context Managers
- Python - Read blob object in python using wand library
- MySQL-Connector-Python module in Python
- Important differences between Python 2.x and Python 3.x with examples
- Python | PRAW - Python Reddit API Wrapper
- Python | Index of Non-Zero elements in Python list
- Python | Convert list to Python array
- Python | Merge Python key values to list
- Reading Python File-Like Objects from C | Python
- twitter-text-python (ttp) module - Python
- Python | Add Logging to Python Libraries
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Sort Python Dictionaries by Key or Value
- Python | Add Logging to a Python Script
- Python | Visualizing O(n) using Python
- SQL using Python | Set 1
- Python PIP
- Python vs PHP
- set add() in python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.