Guanlin Chen
Guanlin Chen

Reputation: 69

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'

Upvotes: 1

Views: 3917

Answers (1)

Philip Purwoko
Philip Purwoko

Reputation: 447

You can use this syntax

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

Upvotes: 3

Related Questions