Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ import warnings
|
|
| 6 |
warnings.filterwarnings(action='ignore', category=UserWarning)
|
| 7 |
|
| 8 |
# 设置中文字体和编码
|
| 9 |
-
plt.rcParams['font.sans-serif'] = ['
|
| 10 |
plt.rcParams['axes.unicode_minus'] = False # 设置正常显示字符
|
| 11 |
|
| 12 |
def process_file(file):
|
|
@@ -54,11 +54,11 @@ def generate_output(file, column1, column2, choice, bins):
|
|
| 54 |
# 统计每个身高分段中不同心血管疾病类别的数量
|
| 55 |
counts = pd.crosstab(data_x, data_y)
|
| 56 |
# 设置画布大小
|
| 57 |
-
plt.figure(figsize=(bins*2,
|
| 58 |
# 绘制分段柱形图
|
| 59 |
counts.plot(kind='bar')
|
| 60 |
# 设置 x 轴刻度标签横向显示
|
| 61 |
-
plt.xticks(rotation
|
| 62 |
plt.xlabel(column1, fontsize=12)
|
| 63 |
plt.ylabel(column2, fontsize=12)
|
| 64 |
# plt.legend(['不患病', '患病'])
|
|
|
|
| 6 |
warnings.filterwarnings(action='ignore', category=UserWarning)
|
| 7 |
|
| 8 |
# 设置中文字体和编码
|
| 9 |
+
plt.rcParams['font.sans-serif'] = ['SimSun'] # 选择合适的中文字体
|
| 10 |
plt.rcParams['axes.unicode_minus'] = False # 设置正常显示字符
|
| 11 |
|
| 12 |
def process_file(file):
|
|
|
|
| 54 |
# 统计每个身高分段中不同心血管疾病类别的数量
|
| 55 |
counts = pd.crosstab(data_x, data_y)
|
| 56 |
# 设置画布大小
|
| 57 |
+
plt.figure(figsize=(bins*2, 8))
|
| 58 |
# 绘制分段柱形图
|
| 59 |
counts.plot(kind='bar')
|
| 60 |
# 设置 x 轴刻度标签横向显示
|
| 61 |
+
plt.xticks(rotation=15)
|
| 62 |
plt.xlabel(column1, fontsize=12)
|
| 63 |
plt.ylabel(column2, fontsize=12)
|
| 64 |
# plt.legend(['不患病', '患病'])
|