Skip to content

Commit

Permalink
Cleanly handle case when show_nr_indiv is large
Browse files Browse the repository at this point in the history
We won't try to render more graphs than we have data for.
  • Loading branch information
karlb committed Aug 30, 2021
1 parent 2efaaf3 commit f35eec8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion causing/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def make_graph(filename, x_weights_idmat_nodeff, y_weights_idmat_nodeff, **kwarg
mediation_indiv_graphs = []
print()

for i in range(show_nr_indiv):
for i in range(min(show_nr_indiv, len(graph_json["mx_indivs"]))):
# compute color base for each individual separately
# using _indiv quantities based on _theo quantities times absolute deviation from median
print("Generate graphs for individual {:5}".format(i))
Expand Down

0 comments on commit f35eec8

Please sign in to comment.