包括基本的图片元素,横坐标,纵坐标,图线粗细,pycharm 绘图中中文显示,颜色设置
import matplotlib.pyplot as plt
x_values = range(1, 1001)
y_values = [x**2 for x in x_values]
plt.style.use('seaborn')
plt.rcParams['font.sans-serif'] = ['KaiTi'] #引入中文
fig, ax = plt.subplots()
# ax.scatter(x_values, y_values, c='green', s=10)
# ax.scatter(x_values, y_values, c=(0, 0.2, 0), s=10) #RGB配色
ax.scatter(x_values, y_values, c=y_values, cmap=plt.cm.Reds, s=10)
ax.set_title("平方的值", fontsize=24)
ax.set_xlabel("数据", fontsize=14)
ax.set_ylabel("数的平方", fontsize=14)
ax.axis([0, 1100, 0, 1100000]) #坐标范围设置
plt.show()