From 2411e584c266ad07b3968a70347b8d4978cbdac5 Mon Sep 17 00:00:00 2001 From: Attila Gabor Date: Fri, 21 Jun 2024 09:09:09 +0200 Subject: [PATCH] fix perturbation plots --- corneto/methods/signal/cellnopt_ilp.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/corneto/methods/signal/cellnopt_ilp.py b/corneto/methods/signal/cellnopt_ilp.py index 5e6ebc0e..b1f7d922 100644 --- a/corneto/methods/signal/cellnopt_ilp.py +++ b/corneto/methods/signal/cellnopt_ilp.py @@ -483,7 +483,12 @@ def plot_fitness(G, exp_list, P, measured_only=False, **kwargs): else: axs[iexp - 1, imarker].set_yticks([]) # Plot perturbation - axs[iexp - 1, len(output_vars)].bar( + if measured_only: + plot_location = len(output_names) + else: + plot_location = N_nodes + + axs[iexp - 1, plot_location].bar( range(len(perturbation_vars)), perturbation_matrix[iexp], color=perturbation_colors, @@ -495,12 +500,12 @@ def plot_fitness(G, exp_list, P, measured_only=False, **kwargs): ) else: # No xtick label - axs[iexp - 1, len(output_vars)].set_xticks([]) + axs[iexp - 1, plot_location].set_xticks([]) - axs[iexp - 1, len(output_vars)].set_ylim([-0.01, 1.1]) - axs[iexp - 1, len(output_vars)].set_yticks([]) + axs[iexp - 1, plot_location].set_ylim([-0.01, 1.1]) + axs[iexp - 1, plot_location].set_yticks([]) if iexp == 1: - axs[iexp - 1, len(output_vars)].set_title("Pert.") + axs[iexp - 1, plot_location].set_title("Pert.") plt.show()