fix(plots): properly set legend title

This commit is contained in:
Xaseiresh 2024-09-03 10:18:01 +02:00
parent 9b0520bee8
commit 46e6239b9a

View file

@ -194,6 +194,9 @@ def decorate_ax(ax, plot_config):
row.mode= "expand"
row.align="right"
if('legend_title' in plot_config):
legend.set_title(plot_config['legend_title']);
ax.grid(True);
def plot_single_graph(fig, plot_config, plot_data):
@ -253,14 +256,7 @@ def plot_lt_sweep(fig, plot_config, plot_data):
if(not 'xmax' in plot_config):
plot_config['xmax'] = np.max(plot_data['steps'][0][x_key]);
if(num_steps > 1):
legend_opts = dict()
legend_opts['title'] = "TEST"
if('legend_title' in plot_config):
legend_opts['title'] = plot_config['legend_title']
ax.legend(**legend_opts);
ax.legend();
decorate_ax(ax, plot_config);
@ -286,7 +282,7 @@ def perform_peak_normalization(plot_data, plot_config):
y_max = max(y_data)
y_min = min(y_data)
scaling_factor = y_max if (y_max > (-y_min)) else y_min
scaling_factor = 0.1 + 0.9*(y_max if (y_max > (-y_min)) else y_min)
for datapoint in y_data:
new_y_data.append(datapoint / scaling_factor)
@ -300,7 +296,7 @@ def perform_offset_removal(plot_data, plot_config):
y_data = step[plot_config['y_key']]
new_y_data = []
offset_value = np.percentile(y_data, 30)
offset_value = np.percentile(y_data, 30) * 0.8
for datapoint in y_data:
new_y_data.append(datapoint - offset_value)