Skip to content

CI: matplotlib failures #26714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TomAugspurger opened this issue Jun 7, 2019 · 4 comments · Fixed by #26715
Closed

CI: matplotlib failures #26714

TomAugspurger opened this issue Jun 7, 2019 · 4 comments · Fixed by #26715

Comments

@TomAugspurger
Copy link
Contributor

https://travis-ci.org/pandas-dev/pandas/jobs/542921706#L2423

=================================== FAILURES ===================================
_______________________ TestDataFramePlots.test_subplots _______________________
[gw1] linux -- Python 3.6.8 /home/travis/miniconda3/envs/pandas-dev/bin/python
self = <pandas.tests.plotting.test_frame.TestDataFramePlots object at 0x7f507ed05128>
    @pytest.mark.slow
    def test_subplots(self):
        df = DataFrame(np.random.rand(10, 3),
                       index=list(string.ascii_letters[:10]))
    
        for kind in ['bar', 'barh', 'line', 'area']:
            axes = df.plot(kind=kind, subplots=True, sharex=True, legend=True)
            self._check_axes_shape(axes, axes_num=3, layout=(3, 1))
            assert axes.shape == (3, )
    
            for ax, column in zip(axes, df.columns):
                self._check_legend_labels(ax,
                                          labels=[pprint_thing(column)])
    
            for ax in axes[:-2]:
                self._check_visible(ax.xaxis)  # xaxis must be visible for grid
                self._check_visible(ax.get_xticklabels(), visible=False)
                self._check_visible(
>                   ax.get_xticklabels(minor=True), visible=False)
pandas/tests/plotting/test_frame.py:387: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <pandas.tests.plotting.test_frame.TestDataFramePlots object at 0x7f507ed05128>
collections = <a list of 2 Text xticklabel objects>, visible = False
    def _check_visible(self, collections, visible=True):
        """
        Check each artist is visible or not
    
        Parameters
        ----------
        collections : matplotlib Artist or its list-like
            target Artist or its list or collection
        visible : bool
            expected visibility
        """
        from matplotlib.collections import Collection
        if not isinstance(collections,
                          Collection) and not is_list_like(collections):
            collections = [collections]
    
        for patch in collections:
>           assert patch.get_visible() == visible
E           AssertionError
pandas/tests/plotting/common.py:137: AssertionError

I'm looking into it now, but will have to go in 30 minutes.

@TomAugspurger
Copy link
Contributor Author

Seems to be a change in matplotlib. The test passes for me locally, with 3.0.3, fails with 3.1.0. (cc @tacaswell, in case this wasn't deliberate. Sorry I don't have an MPL-only reproducer right now)

Just going to change the assert for 3.1.0+ for now.

@simonjayhawkins
Copy link
Member

@TomAugspurger i looked into this, xref #26582, the best i could come up with is that we are using an undocumented method in the test. maybe not part of the official api. our code suggests that we assume a patch object but are testing a text object.

@tacaswell
Copy link
Contributor

My first guess was https://matplotlib.org/api/api_changes.html?highlight=api#major-minor-tick-collisions where we now hide ticks that collide by default, but the issue is things are visible that should not be.

Does the image actually look different?

@TomAugspurger
Copy link
Contributor Author

TomAugspurger commented Jun 7, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants