Skip to content

Commit 82f45e1

Browse files
committed
change wt plots
1 parent 8572ab9 commit 82f45e1

2 files changed

Lines changed: 32 additions & 11 deletions

File tree

eval/boxplot_wt.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
import matplotlib.pyplot as plt
1010
from matplotlib import patches as mpatches
1111
from matplotlib import rcParams
12+
from matplotlib import ticker
1213
import data_cache
1314

14-
# Increase all font sizes by 8 points from their defaults
15-
rcParams.update({key: rcParams[key] + 8 for key in rcParams if "size" in key and isinstance(rcParams[key], (int, float))})
15+
# Increase all font sizes by 16 points from their defaults
16+
rcParams.update({key: rcParams[key] + 16 for key in rcParams if "size" in key and isinstance(rcParams[key], (int, float))})
1617

1718
# ============================================================================
1819
# CONFIGURATION SECTION
@@ -296,16 +297,22 @@ def generate_boxplot(block_dir, zns_dir, output_file, sample_size=None, show_out
296297

297298
# Create boxplot (identical to distribution_comparison_boxplots.py)
298299
if current_data:
300+
# Adjust box width based on number of boxes so they're consistent across subplots
301+
# Base width is 0.8 for 4 boxes, scale proportionally for fewer boxes
302+
num_boxes = len(current_data)
303+
box_width = 0.8 * (num_boxes / 4) if num_boxes > 0 else 0.8
304+
299305
bp = ax.boxplot(current_data,
300306
showfliers=show_outliers,
301-
widths=0.8,
307+
widths=box_width,
302308
medianprops=dict(linewidth=2, color='black'),
303309
patch_artist=True)
304310

305311
# Apply colors and hatches
306312
for i, (box, color, hatch) in enumerate(zip(bp['boxes'], colors, hatches)):
307313
box.set_facecolor(color)
308314
box.set_hatch(hatch)
315+
box.set_hatch_linewidth(3.0)
309316
box.set_alpha(0.7)
310317

311318
# Set x-axis labels (empty for cleaner look)
@@ -318,6 +325,9 @@ def generate_boxplot(block_dir, zns_dir, output_file, sample_size=None, show_out
318325
# Set y-axis label
319326
ax.set_ylabel(metric_label, fontsize=22, weight='bold')
320327

328+
# Use scalar formatter without scientific notation
329+
ax.yaxis.set_major_formatter(ticker.ScalarFormatter(useOffset=False, useMathText=False))
330+
321331
# Rotate y-axis labels
322332
for label in ax.get_yticklabels():
323333
label.set_rotation(45)

eval/ecdf_wt.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
import numpy as np
1515
import data_cache
1616

17-
# Increase all font sizes by 8 points from their defaults
18-
rcParams.update({key: rcParams[key] + 8 for key in rcParams if "size" in key and isinstance(rcParams[key], (int, float))})
17+
# Increase all font sizes by 16 points from their defaults
18+
rcParams.update({key: rcParams[key] + 16 for key in rcParams if "size" in key and isinstance(rcParams[key], (int, float))})
1919

2020
# ============================================================================
2121
# CONFIGURATION SECTION
@@ -391,8 +391,8 @@ def generate_ecdf(block_dir, zns_dir, output_file, metric_type="get_total", samp
391391
print(f"Warning: No run found for {device} {eviction_type}")
392392

393393
# Configure subplot
394-
# ax.set_xlabel("64KiB", fontsize=16, weight='bold')
395-
ax.set_ylabel('Cumulative Probability (%)', fontsize=18)
394+
# ax.set_xlabel("64KiB", fontsize=28, weight='bold')
395+
ax.set_ylabel('Cumulative Probability (%)', fontsize=25)
396396
ax.set_ylim(0, 100)
397397

398398
# Configure x-axis scale
@@ -422,7 +422,6 @@ def exp_formatter(x, pos):
422422

423423
ax.xaxis.set_major_formatter(FuncFormatter(exp_formatter))
424424
else:
425-
ax.set_xlim(left=0)
426425
# Use MaxNLocator to ensure nice, evenly-spaced tick intervals
427426
ax.xaxis.set_major_locator(MaxNLocator(nbins=6, integer=False, prune=None))
428427

@@ -454,14 +453,26 @@ def exp_formatter(x, pos):
454453
Line2D([0], [0], color='#f781bf', linestyle='--', linewidth=LINE_WIDTH,
455454
label='Block (Chunk LRU)', alpha=0.8),
456455
]
457-
fig.legend(ncols=4, handles=legend_lines, bbox_to_anchor=(subplot_center, 0.02),
456+
fig.legend(ncols=4, handles=legend_lines, bbox_to_anchor=(subplot_center, -0.09),
458457
loc='center', fontsize="large", columnspacing=2.0, frameon=False)
459458

460459
# Add a background box for the x-axis label to make it stand out
461-
label_y = 0.08
460+
label_y = 0.01
461+
label_width = 0.18
462+
label_height = 0.08
463+
fig.add_artist(
464+
Rectangle(
465+
(subplot_center - label_width/2, label_y - label_height/2),
466+
label_width,
467+
label_height,
468+
facecolor='white',
469+
edgecolor='none',
470+
zorder=10,
471+
)
472+
)
462473
# Add x-axis label at the bottom, centered over the subplot
463474
fig.text(subplot_center, label_y, 'Latency (ms)', ha='center', va='center',
464-
fontsize=18, weight='bold', zorder=11)
475+
fontsize=30, weight='bold', zorder=11)
465476

466477
# Save figure
467478
plt.savefig(output_file, bbox_inches='tight', dpi=100)

0 commit comments

Comments
 (0)