Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Only calculate averages if necessary
  • Loading branch information
miggaiowski committed Oct 15, 2013
commit c75c67a891f0c9177fc1cacfc09ccf59e3fac596
12 changes: 6 additions & 6 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3025,13 +3025,13 @@ def computeConfInterval(data, med, iq, bootstrap):
med = usermedians[i]

if averages:
# get average
avg = np.average(d)
# use input averages if available
if useraverages is not None and useraverages[i] is not None:
avg = useraverages[i]
else:
avg = np.average(d)


# replace with input averages if available
if useraverages is not None:
if useraverages[i] is not None:
avg = useraverages[i]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a minor point, but would it make more sense to re-arrange this logic so that the average is only computed if needed?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, diff on the way.

On Tue, Oct 15, 2013 at 12:25 PM, Thomas A Caswell <notifications@github.com

wrote:

In lib/matplotlib/axes/_axes.py:

@@ -2996,6 +3024,15 @@ def computeConfInterval(data, med, iq, bootstrap):
if usermedians[i] is not None:
med = usermedians[i]

  •        if averages:
    
  •            # get average
    
  •            avg = np.average(d)
    
  •            # replace with input averages if available
    
  •            if useraverages is not None:
    
  •                if useraverages[i] is not None:
    
  •                    avg = useraverages[i]
    

This is a minor point, but would it make more sense to re-arrange this
logic so that the average is only computed if needed?

—
Reply to this email directly or view it on GitHubhttps://github.com//pull/2520/files#r6974227
.

Miguel Gaiowski

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pep8 is going to complain about this white space

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops

# get high extreme
iq = q3 - q1
Expand Down