ใช้ fontname="Times New Roman" และ fontweight="bold" ใน set_title() หรือ title()
ตัวอย่างโค้ด
import numpy as np
from matplotlib import pyplot as plt, font_manager as fm
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
fig, ax = plt.subplots()
x = np.random.rand(100)
y = np.random.rand(100)
ax.scatter(x, y, c=y, marker="v")
ax.set_title('Scatter Plot With Random Points', fontname="Times New Roman", size=28, fontweight="bold")
plt.show()
ผลลัพธ์
Title แสดงแบบ Bold ด้วยฟอนต์ Times New Roman
