You are reading an old version of the documentation (v2.2.5). For the latest version see
Version 2.2.5
Fork me on GitHub

Table of Contents

Related Topics


Simple matshow example.

import matplotlib.pyplot as plt
import numpy as np

def samplemat(dims):
    """Make a matrix with all zeros and increasing elements on the diagonal"""
    aa = np.zeros(dims)
    for i in range(min(dims)):
        aa[i, i] = i
    return aa

# Display matrix
plt.matshow(samplemat((15, 15)))


The use of the following functions and methods is shown in this example:


<function matshow at 0x7fd7572c8ee0>

Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery