Skip to content

Commit a084ab7

Browse files
committed
plt.subplots before hist plot otherwise squished
1 parent 314ebc6 commit a084ab7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

episodes/07-thresholding.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ episode.
118118
# create a histogram of the blurred grayscale image
119119
histogram, bin_edges = np.histogram(blurred_image, bins=256, range=(0.0, 1.0))
120120
121+
fig, ax = plt.subplots()
121122
plt.plot(bin_edges[0:-1], histogram)
122123
plt.title("Grayscale Histogram")
123124
plt.xlabel("grayscale value")
@@ -223,6 +224,7 @@ plt.show()
223224
> > image = skimage.io.imread("data/shapes-02.jpg", as_gray=True)
224225
> > histogram, bin_edges = np.histogram(image, bins=256, range=(0.0, 1.0))
225226
> >
227+
> > fig, ax = plt.subplots()
226228
> > plt.plot(bin_edges[0:-1], histogram)
227229
> > plt.title("Graylevel histogram")
228230
> > plt.xlabel("gray value")
@@ -323,6 +325,7 @@ blurred_image = skimage.filter.gaussian(gray_image, sigma=1.0)
323325

324326
# show the histogram of the blurred image
325327
histogram, bin_edges = np.histogram(blurred_image, bins=256, range=(0.0, 1.0))
328+
fig, ax = plt.subplots()
326329
plt.plot(bin_edges[0:-1], histogram)
327330
plt.title("Graylevel histogram")
328331
plt.xlabel("gray value")
@@ -670,6 +673,7 @@ data/trial-293.jpg,0.13607895611702128
670673
> > gray_image = skimage.color.rgb2gray(image)
671674
> > blurred_image = skimage.filters.gaussian(gray_image, sigma=1.0)
672675
> > histogram, bin_edges = np.histogram(blurred_image, bins=256, range=(0.0, 1.0))
676+
> > fig, ax = plt.subplots()
673677
> > plt.plot(bin_edges[0:-1], histogram)
674678
> > plt.title("Graylevel histogram")
675679
> > plt.xlabel("gray value")

0 commit comments

Comments
 (0)