junxnone / examples

some code/notebook examples
0 stars 0 forks source link

matplotlib - grid - 网格 #197

Open junxnone opened 4 years ago

junxnone commented 4 years ago

Reference

Brief

plt.grid()

Example

import cv2
import matplotlib.pyplot as plt
%matplotlib inline

img_path = 'xxxx'
bgr_img = cv2.imread(img_path)
img = cv2.cvtColor(bgr_img, cv2.COLOR_BGR2RGB)
fig = plt.figure(figsize=(20,20))
ax = fig.add_subplot(111)
ax.xaxis.set_ticks(range(0, img.shape[1], 100))
ax.yaxis.set_ticks(range(0, img.shape[0], 100))
plt.grid(alpha=0.3)
plt.imshow(img)
junxnone commented 4 years ago

16