Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed handling of `bar(.., bottom=None, log=True)` #1889

Merged
merged 2 commits into from

4 participants

@tacaswell
Owner

re-added lines to make sure that bottom and left are not None in the case of log=True. If this is not done, there will be type exceptions.

Issue #1882

@tacaswell tacaswell referenced this pull request in pydata/pandas
Closed

log=True bar plots are raising with mpl 1.2.1 #3254

@tacaswell
Owner

build errors are inkscape installation errors.

@dmcdougall
Collaborator

I fixed the install errors in 01a4bed.

Sorry to go behind protocol on that commit; I used the GitHub editor and I thought it would make a pull request out of it rather than commit directly to the repository.

@tacaswell tacaswell re-added lines to make sure that `bottom` and `left` are not None in
the case of `log=True`.  If this is not done, there will be type
exceptions.

Issue #1882
d6e3734
@tacaswell
Owner

@dmcdougall ok, rebased.

@neggert

I think I introduced this bug. Can we get a test so it doesn't happen again?

@tacaswell
Owner

@neggert Can you write that test (I am super swamped, have a committee meeting in a week)? I don't think we need an image test for this, just make sure all reasonable arguments don't blow up.

Can you also take a look at the other issues @y-p has brought up in the original issue thread?

@dmcdougall do you want me to rebase this again to get all of the svg tests to run?

@neggert

I can do the test, but it might take me a few days to get to it. I propose to merge this now. I'll make a separate PR with the test when I get to it.

lib/matplotlib/axes.py
@@ -4797,6 +4797,7 @@ def make_iterable(x):
if _bottom is None:
if self.get_yscale() == 'log':
adjust_ylim = True
+ bottom = [1e-100]
@neggert
neggert added a note

You should be able to move this outside of the if statement and just set it to [0]. That was the reason for making the change (nonposy=True) that got this all started. That way it will behave well even if someone wants to work with very small numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
lib/matplotlib/axes.py
@@ -4812,6 +4813,7 @@ def make_iterable(x):
if _left is None:
if self.get_xscale() == 'log':
adjust_xlim = True
+ left = [1e-100]
@neggert
neggert added a note

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@tacaswell
Owner

@neggert Done. I suspected that would be the case, but went with what seemed to be the minimal change (which was replacing those lines)

@tacaswell
Owner

@neggert Do you agree with how this is fixed now?

@neggert
@tacaswell
Owner

@mdboom Can this be merged?

@mdboom mdboom merged commit 16be971 into matplotlib:v1.2.x

1 check passed

Details default The Travis build passed
@tacaswell tacaswell deleted the tacaswell:log_bar_regression branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 9, 2013
  1. @tacaswell

    re-added lines to make sure that `bottom` and `left` are not None in

    tacaswell authored
    the case of `log=True`.  If this is not done, there will be type
    exceptions.
    
    Issue #1882
  2. @tacaswell
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/matplotlib/axes.py
View
8 lib/matplotlib/axes.py
@@ -4797,8 +4797,8 @@ def make_iterable(x):
if _bottom is None:
if self.get_yscale() == 'log':
adjust_ylim = True
- else:
- bottom = [0]
+ bottom = [0]
+
nbars = len(left)
if len(width) == 1:
width *= nbars
@@ -4812,8 +4812,8 @@ def make_iterable(x):
if _left is None:
if self.get_xscale() == 'log':
adjust_xlim = True
- else:
- left = [0]
+ left = [0]
+
nbars = len(bottom)
if len(left) == 1:
left *= nbars
Something went wrong with that request. Please try again.