# !usr/bin/env python
# -*- coding:utf-8 _*-
"""
@FileName: 1
@Time: 2021/12/23,11:15
@Motto: go go go
"""
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt # matplotlib中画二维图像的模块
import seaborn as sns
# 绘制超简单的散点图,变量x1,与x2 的关系
# 定义数据
x1 = np.random.randn(10)
y = x1 + x1 ** 2 - 10
# 确定画布 - 当只有一个图存在的时候,不是必须存在
plt.figure(figsize=(8,4))
# 绘图
plt.scatter(x1,y
, s = 30 # 散点图点的大小
, c ='red' # 颜色
, label = 'point'
)
# 装饰图形
plt.legend() # 显示图形
plt.show() # 让图形显示

Figure_1.png
网友评论