Skip to content

Categorical not hitting update path on fill_between #9494

Closed

Description

@story645

Alerted to by @anntzer in #9350, the fill_between with all categorical doesn't do an update on the y2 and so the following code:

plt.fill_between(['a', 'b', 'c'], ['e', 'f', 'g'],['h','i','j'])

Crashes on the lookup:

/projects/matplotlib/lib/matplotlib/artist.py in convert_yunits(self, y)
    198         if ax is None or ax.yaxis is None:
    199             return y
--> 200         return ax.yaxis.convert_units(y)
    201 
    202     @property

~/projects/matplotlib/lib/matplotlib/axis.py in convert_units(self, x)
   1489             return x
   1490 
-> 1491         ret = self.converter.convert(x, self.units, self)
   1492         return ret
   1493 

This seems to be limited to categoricals because dates work as expected:

import numpy as np
import pandas as pd
dates = pd.date_range('1990-10-10', '2004-10-10', freq='M')
x = np.arange(84)
y1 = dates[:84]
y2 = dates[84:]
plt.fill_between(x, y2, y1)

index

And as @anntzer suggested, the axis behavior should be modified such that once units are set on that axis, the axis should error out if new input isn't in the same units. As expected, the following errors out: plt.fill_between(x, x, y1)

Activity

  1. added
    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
    on Oct 20, 2017
  2. changed the title [-]Categorical Y2 not hitting update path on fill_between[/-] [+]Categorical not hitting update path on fill_between[/+] on Oct 20, 2017
  3. added this to the v2.1.1 milestone on Oct 21, 2017
  4. jklymak commented on Nov 6, 2017

    @jklymak
    Member

    #9705 fixes this....
    figure_1

  5. self-assigned this
    on Nov 6, 2017
  6. dstansby commented on Nov 7, 2017

    @dstansby
    Member

    Fixed by #9705

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

Metadata

Metadata

Assignees

Labels

Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: categorical

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions