简体   繁体   中英

How to increase title font size on axs[i].title.set_text

I'm using Pythons matplotlib and this is my code:

fig, axs = plt.subplots(10,10, figsize=(100, 100))
fig.subplots_adjust(hspace = .005, wspace= .1)
axs = axs.ravel()
for i, img in enumerate(glob.glob('C:/Users/User/Desktop/Tensorflow/0_180_direction_indicator/*.jpg')):
    image = cv2.imread(img)
    axs[i].axis('off')
    axs[i].imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
    axs[i].title.set_text(img[-13:-4] ,fontsize= 50)

But it shows

TypeError Traceback (most recent call last)

in

  6     axs[i].axis('off')

  7     axs[i].imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))

----> 8 axs[i].title.set_text(img[-13:-4],fontsize= 50)

TypeError: set_text() got an unexpected keyword argument 'fontsize'

You can use this syntax

axes[0].set_title("title",fontsize=50)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM