Skip to content

Commit

Permalink
fix figures not showing with mix of upper and lower case variables
Browse files Browse the repository at this point in the history
Before naming variables with lower and upper case could cause them to be sorted in wrong order since Python sorts by default first upper case strings (AB...ab...), and then lower case strings, whereas order in JavaScript is  aAbB...
  • Loading branch information
nikolasibalic authored Aug 1, 2019
1 parent 50c9068 commit 245cdac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ifigures/interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ def _output_html(self):
defaults = tuple([widget.default for widget in self.widgets.values()])

#Now reorder alphabetically by names so divnames match javascript
names,values,defaults = zip(*sorted(zip(names,values,defaults)))
names,values,defaults = zip(*sorted(zip(names,values,defaults),
key=lambda tup: tup[0].lower()))

results = [self.function(**dict(zip(names, vals)))
for vals in itertools.product(*values)]
Expand Down

0 comments on commit 245cdac

Please sign in to comment.