Matplotlib is an excellent 2D and 3D graphics library for generating scientific figures.
In [2]:
# This line configures matplotlib to show figures embedded in the notebook, instead of opening a new window for each figure.
%matplotlib inline
In [4]:
from pylab import *
import numpy as np
I = np.identity(3)
In [5]:
x = linspace(0, 5, 10)
y = x ** 2
In [8]:
figure()
plot(x, y, '--r')
xlabel('x')
ylabel('y')
title('title')
show()
In [9]:
figure()
x = np.random.random(50)
y = x * 10 + np.random.random(50)
scatter(x, y)
show()
In [10]:
figure()
hist(np.random.randn(10000))
show()
In [11]:
import matplotlib.image as mpimg
img=mpimg.imread('nao_camera.png')
img
Out[11]:
In [12]:
imgplot = imshow(img)
In [13]:
g_img = img[:, :, 1]
imgplot = imshow(g_img)
imgplot.set_cmap('hot')
cb = plt.colorbar()
In [14]:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.axes3d import Axes3D
In [15]:
x = linspace(0, 5, 100)
y = x ** 2
z = np.sin(x)
In [16]:
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
p = ax.plot(x, y, z)