Spaces:
Sleeping
Sleeping
Heatmap: Reducing the size of the squares in the table and the font size in them
Browse files- analyze_winscore.py +8 -5
analyze_winscore.py
CHANGED
|
@@ -218,14 +218,16 @@ def create_heatmap(data_matrix, original_scores,
|
|
| 218 |
x_axis_visible=True,
|
| 219 |
y_axis_visible=True,
|
| 220 |
):
|
| 221 |
-
FONTSIZE =
|
| 222 |
|
| 223 |
n_rows, n_cols = data_matrix.shape
|
| 224 |
y_axis_size = 0
|
| 225 |
x_axis_size = 0
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
|
|
|
|
|
|
| 229 |
plot_width = n_rows * cell_size + (n_rows * cell_width_border + y_axis_size if y_axis_visible else 0)
|
| 230 |
plot_height = n_cols * cell_size + (n_cols * cell_height_border + x_axis_size if x_axis_visible else 0)
|
| 231 |
|
|
@@ -304,7 +306,8 @@ def create_heatmap(data_matrix, original_scores,
|
|
| 304 |
|
| 305 |
# Add labels with dynamic text color
|
| 306 |
labels = LabelSet(x='x', y='y', text='value', source=label_source,
|
| 307 |
-
text_color='text_color', text_align='center', text_baseline='middle'
|
|
|
|
| 308 |
p.add_layout(labels)
|
| 309 |
|
| 310 |
# Customize the plot appearance
|
|
|
|
| 218 |
x_axis_visible=True,
|
| 219 |
y_axis_visible=True,
|
| 220 |
):
|
| 221 |
+
FONTSIZE = 9
|
| 222 |
|
| 223 |
n_rows, n_cols = data_matrix.shape
|
| 224 |
y_axis_size = 0
|
| 225 |
x_axis_size = 0
|
| 226 |
+
cell_padding = 3
|
| 227 |
+
cell_width_border = 1 + cell_padding
|
| 228 |
+
#cell_height_border = 4 + cell_padding
|
| 229 |
+
cell_height_border = cell_padding
|
| 230 |
+
cell_size = 22
|
| 231 |
plot_width = n_rows * cell_size + (n_rows * cell_width_border + y_axis_size if y_axis_visible else 0)
|
| 232 |
plot_height = n_cols * cell_size + (n_cols * cell_height_border + x_axis_size if x_axis_visible else 0)
|
| 233 |
|
|
|
|
| 306 |
|
| 307 |
# Add labels with dynamic text color
|
| 308 |
labels = LabelSet(x='x', y='y', text='value', source=label_source,
|
| 309 |
+
text_color='text_color', text_align='center', text_baseline='middle',
|
| 310 |
+
text_font_size=f"{FONTSIZE}pt")
|
| 311 |
p.add_layout(labels)
|
| 312 |
|
| 313 |
# Customize the plot appearance
|