Skip to content

Commit

Permalink
benchmarks: use wong as default colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Wünsche committed Feb 9, 2024
1 parent 89d1fad commit ee37dd3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions betree/haura-benchmarks/haura-plots/haura_plots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ def main():
sys.exit(2)
data = []

# Prep the color scheme
util.init_colormap()

for path in sys.argv[1:]:
with open(f"{path}/betree-metrics.jsonl", 'r', encoding="UTF-8") as metrics:
data = util.read_jsonl(metrics)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def plot_cache(data, path):

# Capacity vs Size (Peak Check)
cap = np.array([temp['cache']['capacity'] / 1024 / 1024 for temp in data])
axs[0].plot(epoch, cap, label='capacity')
axs[0].plot(epoch, cap, label='capacity', linestyle=':')
axs[0].plot(epoch, [temp['cache']['size'] / 1024 / 1024 for temp in data], label='size')
axs[0].set_xticks(eticks, eticks_formatted)
axs[0].set_ylabel("Size [MiB]")
Expand All @@ -43,7 +43,7 @@ def plot_cache(data, path):
oax.legend(bbox_to_anchor=(1.0, 1.2))
axs[1].legend(ncols=2, bbox_to_anchor=(0.8, 1.2))

# insertions (reads, new nodes, updates, writes) vs evictions (updates) vs removals (reads)
# insertions (reads, new nodes, updates, writes) vs evictions (updates, reads) vs removals (updates)
axs[2].plot(epoch, util.diff_window([temp['cache']['insertions'] for temp in data]), label='insertions')
axs[2].plot(epoch, util.diff_window([temp['cache']['evictions'] for temp in data]), label='evictions')
axs[2].plot(epoch, util.diff_window([temp['cache']['removals'] for temp in data]), label='removals')
Expand Down
16 changes: 16 additions & 0 deletions betree/haura-benchmarks/haura-plots/haura_plots/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"""

import json
import matplotlib.pyplot as plt
from cycler import cycler

# Constants
BLOCK_SIZE=4096
Expand All @@ -21,6 +23,20 @@

MARKERS=['x', '.', '^', 'v', '<', '>']

def init_colormap():
"""Create the "Wong" color scheme and set it as matplotlib default."""
wong = cycler(linestyle=['-', '--', '-.']) * cycler(color=[
"#56B4E9",
"#E69F00",
"#009E73",
"#F0E442",
"#0072B2",
"#D55E00",
"#CC79A7",
"#000000",
])
plt.rc('axes', prop_cycle=wong)

# Formatting
def ms_to_string(time):
"""Nicer formatter for epoch strings in figures"""
Expand Down

0 comments on commit ee37dd3

Please sign in to comment.