Tutorial by Examples

There are several ways to go about installing matplotlib, some of which will depend on the system you are using. If you are lucky, you will be able to use a package manager to easily install the matplotlib module and its dependencies. Windows On Windows machines you can try to use the pip package ...
import pylab as plt import numpy as np plt.style.use('ggplot') fig = plt.figure(1) ax = plt.gca() # make some testing data x = np.linspace( 0, np.pi, 1000 ) test_f = lambda x: np.sin(x)*3 + np.cos(2*x) # plot the test data ax.plot( x, test_f(x) , lw = 2) # set the axis labels ax...
Matplotlib supports both object-oriented and imperative syntax for plotting. The imperative syntax is intentionally designed to be very close to Matlab syntax. The imperative syntax (sometimes called 'state-machine' syntax) issues a string of commands all of which act on the most recent figure or a...
Display a two dimensional (2D) array on the axes. import numpy as np from matplotlib.pyplot import imshow, show, colorbar image = np.random.rand(4,4) imshow(image) colorbar() show()

Page 1 of 1