Minor cleanups

* PEP8 clean ups (space after commas, docstring spacing, prefer parentheses over line continuation)
* Simplify creation of test images.
* Use `plt.subplots` instead of state machine
* Minor wording modifications
This commit is contained in:
Tony S Yu
2013-04-25 22:47:22 -05:00
parent 18839cdf08
commit 5c3c75cd09
3 changed files with 63 additions and 66 deletions
+8 -11
View File
@@ -1,23 +1,20 @@
import matplotlib
import matplotlib.pyplot as plt
from skimage.data import camera
from skimage.filter import roberts,sobel
from skimage.filter import roberts, sobel
image = camera()
edge_roberts = roberts(image)
edge_sobel = sobel(image)
plt.figure(figsize=(8, 2.5))
plt.subplot(1, 2, 1)
plt.imshow(edge_roberts, cmap=plt.cm.gray)
plt.title('Roberts Edge Detection')
plt.axis('off')
fig, (ax0, ax1) = plt.subplots(ncols=2)
plt.subplot(1, 2, 2)
plt.imshow(edge_sobel, cmap=plt.cm.gray)
plt.title('Sobel Edge Detection')
plt.axis('off')
ax0.imshow(edge_roberts, cmap=plt.cm.gray)
ax0.set_title('Roberts Edge Detection')
ax0.axis('off')
ax1.imshow(edge_sobel, cmap=plt.cm.gray)
ax1.set_title('Sobel Edge Detection')
ax1.axis('off')
plt.show()