mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-05-01 12:11:14 +00:00
Implement dark mode using style sheets
This commit is contained in:
@@ -239,16 +239,9 @@ def plot_entries(entries, title=None, output=None, dark=False):
|
||||
colors = [bench_colors[bench] for bench in bench_names]
|
||||
|
||||
fig_height = max(4.0, 0.3 * len(entries) + 1.5)
|
||||
style = "dark_background" if dark else None
|
||||
with plt.style.context(style) if style else plt.style.context("default"):
|
||||
fig, ax = plt.subplots(figsize=(10, fig_height))
|
||||
if dark:
|
||||
fig.patch.set_facecolor("black")
|
||||
ax.set_facecolor("black")
|
||||
ax.tick_params(colors="white")
|
||||
ax.xaxis.label.set_color("white")
|
||||
ax.yaxis.label.set_color("white")
|
||||
ax.title.set_color("white")
|
||||
for spine in ax.spines.values():
|
||||
spine.set_color("white")
|
||||
|
||||
y_pos = range(len(labels))
|
||||
ax.barh(y_pos, values, color=colors)
|
||||
|
||||
Reference in New Issue
Block a user