krishaamer commited on
Commit
e277b73
·
1 Parent(s): 4db6a4b

Add padding to fit in the Chinese titles

Browse files
Files changed (1) hide show
  1. page_likert.py +5 -3
page_likert.py CHANGED
@@ -156,6 +156,9 @@ def show():
156
  fig, axs = plt.subplots(num_rows, 2, figsize=(15, 5 * num_rows))
157
  axs = axs.flatten() # Flatten the array of subplots
158
 
 
 
 
159
  # Loop through each field in the category to create individual bar plots
160
  for i, field in enumerate(fields):
161
  # Create the bar plot
@@ -164,8 +167,7 @@ def show():
164
  # Add title and labels
165
  title_chinese = field
166
  title_english = field_translation_mapping[category][i]
167
- axs[i].set_title(f"{title_chinese}\n{title_english}", fontproperties=chinese_font) # Add both versions to the title
168
-
169
  axs[i].set_xlabel('Likert Scale')
170
  axs[i].set_ylabel('Frequency')
171
 
@@ -173,5 +175,5 @@ def show():
173
  for i in range(num_fields, num_rows * 2):
174
  fig.delaxes(axs[i])
175
 
176
- # Show the plot in Streamlit
177
  st.pyplot(fig)
 
156
  fig, axs = plt.subplots(num_rows, 2, figsize=(15, 5 * num_rows))
157
  axs = axs.flatten() # Flatten the array of subplots
158
 
159
+ # Add padding to fit in the Chinese titles
160
+ plt.subplots_adjust(hspace=0.4)
161
+
162
  # Loop through each field in the category to create individual bar plots
163
  for i, field in enumerate(fields):
164
  # Create the bar plot
 
167
  # Add title and labels
168
  title_chinese = field
169
  title_english = field_translation_mapping[category][i]
170
+ axs[i].set_title(f"{title_chinese}\n{title_english}", fontproperties=chinese_font)
 
171
  axs[i].set_xlabel('Likert Scale')
172
  axs[i].set_ylabel('Frequency')
173
 
 
175
  for i in range(num_fields, num_rows * 2):
176
  fig.delaxes(axs[i])
177
 
178
+ # Show the plot
179
  st.pyplot(fig)