Seaborn 是一个 Python 数据可视化库,它建立在 Matplotlib 之上,提供了更多高级的绘图功能。以下是一些关于 Seaborn 的基本教程和资源。

快速开始

  1. 安装 Seaborn:首先,确保你已经安装了 Matplotlib,然后使用以下命令安装 Seaborn:

    pip install seaborn
    
  2. 基本使用:Seaborn 的基本使用非常简单,以下是一个简单的例子:

    import seaborn as sns
    import matplotlib.pyplot as plt
    
    sns.set()  # 设置 Seaborn 的默认风格
    plt.figure(figsize=(8, 6))  # 设置图形大小
    sns.lineplot(x=[1, 2, 3, 4, 5], y=[2, 3, 5, 7, 11])  # 绘制折线图
    plt.show()
    

资源链接

示例图片

折线图

lineplot

散点图

scatterplot

直方图

histogram