adding axes sharing to displays of related images

for better interaction

sharing achieved by setting sharex and sharey, and
setting the axes 'adjustable' parameter to 'box-forced'
This commit is contained in:
martin
2015-10-12 15:58:57 +02:00
parent 8ff6d2d8e3
commit 9fa9c0387c
24 changed files with 105 additions and 54 deletions
+3 -3
View File
@@ -48,8 +48,8 @@ import matplotlib.pyplot as plt
image = data.astronaut()
fig = plt.figure(figsize=(14, 7))
ax_each = fig.add_subplot(121)
ax_hsv = fig.add_subplot(122)
ax_each = fig.add_subplot(121, adjustable='box-forced')
ax_hsv = fig.add_subplot(122, sharex=ax_each, sharey=ax_each, adjustable='box-forced')
# We use 1 - sobel_each(image)
# but this will not work if image is not normalized
@@ -107,7 +107,7 @@ def sobel_gray(image):
return filters.sobel(image)
fig = plt.figure(figsize=(7, 7))
ax = fig.add_subplot(111)
ax = fig.add_subplot(111, sharex=ax_each, sharey=ax_each, adjustable='box-forced')
# We use 1 - sobel_gray(image)
# but this will not work if image is not normalized