Skip to content

Commit

Permalink
tools/plot.py: fix the styling a little
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodrigodd committed Aug 26, 2023
1 parent bf9ab65 commit 4ac46ff
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions tools/plot.py
Expand Up @@ -56,7 +56,7 @@

('#FF6F0F', 'search_objects', 'Ppu::search_objects'),
('#FF8F3F', 'draw_scan_line', 'ppu::draw_scan_line'),
('#FFBF7F', 'PPU', 'Ppu::'),
('#FFBF7F', 'PPU', 'ppu::'),

('#5FAF5F', 'SoundController', 'SoundController::'),
('#3F9F3F', 'Timer', 'Timer'),
Expand All @@ -68,6 +68,14 @@
('#8F3FFF', 'format', 'fmt::format::format_inner'),
]

# By default, the plot will use the filename as the title, but if it is in this
# dictionary, it will use the value as the title instead.
filename_to_title = {
# 'slow.folded': 'No interrupt prediction',
'interpreter.folded': 'Intepreter',
'jit.folded': 'JIT',
}

files = sys.argv[1:]

n = len(files)
Expand Down Expand Up @@ -168,9 +176,11 @@ def parse_inferno_stacks_folded(stacks):
label.set_text('')
pct_label.set_text('')

ax.set_title(filename)
title = filename_to_title.get(filename, filename)
ax.set_title(title)

ax.legend(loc='center left', bbox_to_anchor=(-0.00, 0.5), bbox_transform=plt.gcf().transFigure)
# fig.tight_layout()
# plt.savefig("output.png", bbox_inches="tight")
handles, labels = ax.get_legend_handles_labels()
fig.legend(handles, labels, loc='center left', bbox_to_anchor=(-0.15, 0.50), bbox_transform=plt.gcf().transFigure)
fig.tight_layout()
plt.savefig("output.svg", bbox_inches="tight", transparent=True)
plt.show()

0 comments on commit 4ac46ff

Please sign in to comment.