used plt.subplots everywhere

This commit is contained in:
Siva Prasad Varma
2014-03-14 17:37:14 +05:30
parent c60d15f2f4
commit fb72fb04b2
22 changed files with 350 additions and 405 deletions
+10 -13
View File
@@ -28,20 +28,17 @@ image = camera()
thresh = threshold_otsu(image)
binary = image > thresh
plt.figure(figsize=(8, 2.5))
plt.subplot(1, 3, 1)
plt.imshow(image, cmap=plt.cm.gray)
plt.title('Original')
plt.axis('off')
f, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(8, 2.5))
ax1.imshow(image, cmap=plt.cm.gray)
ax1.set_title('Original')
ax1.axis('off')
plt.subplot(1, 3, 2, aspect='equal')
plt.hist(image)
plt.title('Histogram')
plt.axvline(thresh, color='r')
ax2.hist(image)
ax2.set_title('Histogram')
ax2.axvline(thresh, color='r')
plt.subplot(1, 3, 3)
plt.imshow(binary, cmap=plt.cm.gray)
plt.title('Thresholded')
plt.axis('off')
ax3.imshow(binary, cmap=plt.cm.gray)
ax3.set_title('Thresholded')
ax3.axis('off')
plt.show()