9951 explained code solutions for 126 technologies

python-matplotlibHow to set colormap

import numpy as np
import matplotlib.pyplot as plt

data = np.random.randn(30, 30)

plt.pcolormesh(data, cmap='magma', rasterized=True, vmin=-4, vmax=4)
plt.show()ctrl + c
import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities

import numpy as np

load Numpy module for Python

np.random.randn(30, 30)

generate random matrix 30x30 in size


create pseudo color plot


set colormap to use


render chart in a separate window