fix(plots): properly set legend title
This commit is contained in:
parent
9b0520bee8
commit
46e6239b9a
1 changed files with 6 additions and 10 deletions
|
@ -194,6 +194,9 @@ def decorate_ax(ax, plot_config):
|
||||||
row.mode= "expand"
|
row.mode= "expand"
|
||||||
row.align="right"
|
row.align="right"
|
||||||
|
|
||||||
|
if('legend_title' in plot_config):
|
||||||
|
legend.set_title(plot_config['legend_title']);
|
||||||
|
|
||||||
ax.grid(True);
|
ax.grid(True);
|
||||||
|
|
||||||
def plot_single_graph(fig, plot_config, plot_data):
|
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):
|
if(not 'xmax' in plot_config):
|
||||||
plot_config['xmax'] = np.max(plot_data['steps'][0][x_key]);
|
plot_config['xmax'] = np.max(plot_data['steps'][0][x_key]);
|
||||||
|
|
||||||
if(num_steps > 1):
|
ax.legend();
|
||||||
legend_opts = dict()
|
|
||||||
legend_opts['title'] = "TEST"
|
|
||||||
|
|
||||||
if('legend_title' in plot_config):
|
|
||||||
legend_opts['title'] = plot_config['legend_title']
|
|
||||||
|
|
||||||
ax.legend(**legend_opts);
|
|
||||||
|
|
||||||
decorate_ax(ax, plot_config);
|
decorate_ax(ax, plot_config);
|
||||||
|
|
||||||
|
@ -286,7 +282,7 @@ def perform_peak_normalization(plot_data, plot_config):
|
||||||
y_max = max(y_data)
|
y_max = max(y_data)
|
||||||
y_min = min(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:
|
for datapoint in y_data:
|
||||||
new_y_data.append(datapoint / scaling_factor)
|
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']]
|
y_data = step[plot_config['y_key']]
|
||||||
new_y_data = []
|
new_y_data = []
|
||||||
|
|
||||||
offset_value = np.percentile(y_data, 30)
|
offset_value = np.percentile(y_data, 30) * 0.8
|
||||||
|
|
||||||
for datapoint in y_data:
|
for datapoint in y_data:
|
||||||
new_y_data.append(datapoint - offset_value)
|
new_y_data.append(datapoint - offset_value)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue