Ethscriptions commited on
Commit
713710f
·
verified ·
1 Parent(s): 8a81dc8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -76,15 +76,15 @@ def create_print_layout(data, title):
76
  if data.empty:
77
  return None
78
 
79
- # 设置 A5 纵向尺寸(单位:英寸)
80
- fig = plt.figure(figsize=(5.83, 8.27), dpi=300)
81
 
82
  # 减小边距,最大化利用空间
83
  plt.subplots_adjust(left=0.02, right=0.98, top=0.98, bottom=0.02)
84
 
85
  # 创建网格,减小间距
86
- rows = (len(data) + 2) // 3 # 向上取整除法
87
- gs = gridspec.GridSpec(rows, 3, hspace=0.1, wspace=0.1) # 显著减小间距
88
 
89
  # 设置字体和样式
90
  plt.rcParams['font.family'] = 'sans-serif'
@@ -95,8 +95,8 @@ def create_print_layout(data, title):
95
 
96
  # 填充数据
97
  for idx, (hall, end_time) in enumerate(data.values):
98
- row = idx // 3
99
- col = idx % 3
100
 
101
  # 创建子图
102
  ax = plt.subplot(gs[row, col])
@@ -161,4 +161,4 @@ if uploaded_file:
161
  if part2_image:
162
  st.image(part2_image)
163
  else:
164
- st.info("夜班部分没有数据")
 
76
  if data.empty:
77
  return None
78
 
79
+ # 设置 A5 横向尺寸(单位:英寸)
80
+ fig = plt.figure(figsize=(8.27, 5.83), dpi=300)
81
 
82
  # 减小边距,最大化利用空间
83
  plt.subplots_adjust(left=0.02, right=0.98, top=0.98, bottom=0.02)
84
 
85
  # 创建网格,减小间距
86
+ rows = (len(data) + 3) // 4 # 向上取整除法
87
+ gs = gridspec.GridSpec(rows, 4, hspace=0.1, wspace=0.1) # 显著减小间距
88
 
89
  # 设置字体和样式
90
  plt.rcParams['font.family'] = 'sans-serif'
 
95
 
96
  # 填充数据
97
  for idx, (hall, end_time) in enumerate(data.values):
98
+ row = idx // 4
99
+ col = idx % 4
100
 
101
  # 创建子图
102
  ax = plt.subplot(gs[row, col])
 
161
  if part2_image:
162
  st.image(part2_image)
163
  else:
164
+ st.info("夜班部分没有数据")