From 06b05275c25b88ff378bf891df8d562aab30a9ba Mon Sep 17 00:00:00 2001 From: Guillaume Raffy Date: Wed, 22 Oct 2025 14:53:50 +0200 Subject: [PATCH] when plotting, the legend of the graph is now also output on stdout - this is a workaround for a bug where the legend often appears trucated on the pdf work related to [https://bugzilla.ipr.univ-rennes.fr/show_bug.cgi?id=4171] --- concho/procs_chooser.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/concho/procs_chooser.py b/concho/procs_chooser.py index 89ebb46..6ee9bac 100644 --- a/concho/procs_chooser.py +++ b/concho/procs_chooser.py @@ -14,6 +14,7 @@ import hashlib from concho.config import Cpu, MemSize, Configurator, Config # from concho import dell from pathlib import Path +import logging markerTypes = [',', '+', '.', '^', 'v', '<', '>', 'o', '*', '1', '2', '3', '4', '8', 's', 'p', 'h', 'H', 'x', 'X', 'D', 'd', '|', '_'] # for c in ascii_lowercase: @@ -198,6 +199,7 @@ def plot_configs(configs: List[Config], xaxis_def: ConfigAxisDef, yaxis_def: Con # markersCycler = itertools.cycle(itertools.product(markerTypes, markerColors)) config_index = 0 + legend = {} for config in configs: cpu = config.cpu config_label = str(config.num_servers) + '_' + config.chassis.uid + '_' + str(config.num_cpu_per_server) + '_' + cpu.uid + '_' + str(config.ram_size / config.num_servers) + 'gb' @@ -205,14 +207,16 @@ def plot_configs(configs: List[Config], xaxis_def: ConfigAxisDef, yaxis_def: Con x1 = xaxis_def.get_value_for_config(config) y1 = yaxis_def.get_value_for_config(config) - print(config_label, x1, y1) + logging.info(f'config {config_label}: x={x1}, y={y1}') if y1 > 0.0001: color = getColorCodeFromItemLabel(config_label) # marker = markersCycler.next() # marker = get_marker_from_label( label ) # print(x1, y1) + marker = create_unique_marker(config_index) short_label = config_label.replace('dell-poweredge-', '').replace('intel-xeon-', '').replace('hpe-proliant-', '').replace('-gen', '-g') - plt.scatter(x1, y1, facecolors=color, s=(markerSize * len(create_unique_marker(config_index))), marker=r'$\mathrm{%s}$' % create_unique_marker(config_index), label=short_label) + plt.scatter(x1, y1, facecolors=color, s=(markerSize * len(marker)), marker=r'$\mathrm{%s}$' % marker, label=short_label) + legend[marker] = short_label if False: # y1 > 5.0e16: plt.annotate(u'%s' % short_label, xy=(x1, y1), xytext=(x1 * 4.0, (y1 - 5.2e16) * 7.1), @@ -231,6 +235,8 @@ def plot_configs(configs: List[Config], xaxis_def: ConfigAxisDef, yaxis_def: Con plt.grid(visible=True, which='minor', color='b', linestyle='-', linewidth=0.2) plt.legend(bbox_to_anchor=(1.1, 1.1), ncol=2) plt.draw() + for marker in legend: + logging.info(f'config {marker}: {legend[marker]}') if figure_file_path: plt.savefig(figure_file_path) else: