use scientific notation if values are too large in the tables

This commit is contained in:
Youngjoon Lee 2024-09-11 08:50:51 +09:00
parent 655be33d66
commit 9c32dc3241
No known key found for this signature in database
GPG Key ID: 167546E2D1712F8C
2 changed files with 5 additions and 3 deletions

View File

@ -65,8 +65,8 @@ def analyze_versus(data: pd.DataFrame, x_field: str, outdir: str):
columns = [x_field, "queue_type"] + flatten_fields
table_data = max_paramset_data[columns].sort_values(by=[x_field, "queue_type"])
# Prepare to display values with only 2 decimal places
table_data[flatten_fields] = table_data[flatten_fields].applymap(
lambda x: f"{x:.2f}"
table_data[fields] = table_data[fields].map(
lambda x: f"{x:.2e}" if abs(x) >= 1e6 else f"{x:.2f}"
)
# Display the table as a separate subplot
fig_table, ax_table = plt.subplots(

View File

@ -52,7 +52,9 @@ def analyze_versus(data: pd.DataFrame, x_field: str, outdir: str):
columns = [x_field, "queue_type"] + fields
table_data = max_paramset_data[columns].sort_values(by=[x_field, "queue_type"])
# Prepare to display values with only 2 decimal places
table_data[fields] = table_data[fields].applymap(lambda x: f"{x:.2f}")
table_data[fields] = table_data[fields].map(
lambda x: f"{x:.2e}" if abs(x) >= 1e6 else f"{x:.2f}"
)
# Display the table as a separate subplot
fig_table, ax_table = plt.subplots(
figsize=(len(columns) * 1.8, len(table_data) * 0.3)