0
点赞
收藏
分享

微信扫一扫

element-ui组件table去除下方滚动条,实现鼠标左右拖拽移动表格

穆熙沐 2024-05-29 阅读 6

1. 将多个柱状绘制在一个图中

import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

# 创建示例数据
categories = ['A', 'B', 'C', 'D', 'E']
values1 = np.random.randint(1, 10, size=len(categories))
values2 = np.random.randint(1, 10, size=len(categories))

# 创建 DataFrame
df = pd.DataFrame({
    'Category': categories * 2,
    'Value': np.concatenate([values1, values2]),
    'Type': ['Value 1'] * len(categories) + ['Value 2'] * len(categories)
})

# 使用 Seaborn 绘制
sns.barplot(x='Category', y='Value', hue='Type', data=df)

# 添加标签
plt.xlabel('Category')
plt.ylabel('Value')
plt.title('Multiple Bar Plots')
plt.legend(title='Type')
plt.show()

在这里插入图片描述

2. 将多个折线图画在一张图上

import seaborn as sns
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei']  # 指定中文字体为黑体
plt.rcParams['axes.unicode_minus'] = False  # 解决负号显示为方块的问题
x = np.linspace(0,24,24)
sns.lineplot(x=x,y=df_23guoqing['flow'], marker='o',label='23国庆')
# sns.lineplot(x=x,y=df_240101['flow'], marker='s',label='24元旦')
sns.lineplot(x=x,y=df_24qingm['flow'], marker='+',label='24清明')
sns.lineplot(x=x,y=df_240501['flow'], marker='x',label='24劳动')
sns.lineplot(x=x,y=df_240205['flow'], marker='*',label='冬季平时1')
sns.lineplot(x=x,y=df_240508['fflow'], marker='>',label='夏季平时2')
plt.xlabel('小时')
plt.ylabel('车流量 辆/h')
plt.legend()
plt.show()

在这里插入图片描述
在这里插入图片描述

举报

相关推荐

0 条评论