In [27]:
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 5, 11)
y = x ** 2
%matplotlib inline
#fig = plt.figure()
x
y
Out[27]:
In [32]:
f,a = plt.subplots(1,2)
plt.tight_layout()
# Now use the axes object to add stuff to plot
#axes.plot(x, y, 'r')
#axes.set_xlabel('x')
#axes.set_ylabel('y')
#axes.set_title('title');
a
Out[32]:
In [36]:
f,a = plt.subplots(nrows=1, ncols=2)
a[0].plot(x,y)
a[1].plot(y,x)
a[0].set_title("first")
a[0].set_xlabel("my x label")
Out[36]:
In [20]:
a
Out[20]:
In [18]:
a
Out[18]:
In [19]:
f,a = plt.subplots(nrows=1, ncols=2)
In [9]:
f,a = plt.subplots(nrows=2, ncols=2)
plt.tight_layout()
In [5]:
for ax in axes:
ax.plot(x, y, 'b')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_title('title')
# Display the figure object
fig
Out[5]:
for ax in axes:
ReplyDeleteax.plot(x, y, 'b')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_title('title')
# Display the figure object
fig
sir i got this error
AttributeError Traceback (most recent call last)
in ()
1 for ax in axes:
----> 2 ax.plot(x, y, 'b')
3 ax.set_xlabel('x')
4 ax.set_ylabel('y')
5 ax.set_title('title')
AttributeError: 'Figure' object has no attribute 'plot'