Skip to content

Matplotlib 3.0 compatibility #22790

Closed
Closed
@TomAugspurger

Description

@TomAugspurger

I have some local failures with matplotlib 3.x only

========================================================================= FAILURES =========================================================================
______________________________________________________ TestTSPlot.test_matplotlib_scatter_datetime64 _______________________________________________________

self = <pandas.tests.plotting.test_datetimelike.TestTSPlot object at 0x118a34cf8>

    def test_matplotlib_scatter_datetime64(self):
        # https://github.com/matplotlib/matplotlib/issues/11391
        df = DataFrame(np.random.RandomState(0).rand(10, 2),
                       columns=["x", "y"])
        df["time"] = date_range("2018-01-01", periods=10, freq="D")
        fig, ax = self.plt.subplots()
        ax.scatter(x="time", y="y", data=df)
        fig.canvas.draw()
        label = ax.get_xticklabels()[0]
>       assert label.get_text() == '2017-12-12'
E       AssertionError: assert '2017-12-08' == '2017-12-12'
E         - 2017-12-08
E         ?         ^^
E         + 2017-12-12
E         ?         ^^

pandas/tests/plotting/test_datetimelike.py:1495: AssertionError
_________________________________________ TestDataFramePlots.test_if_scatterplot_colorbar_affects_xaxis_visibility _________________________________________

self = <pandas.tests.plotting.test_frame.TestDataFramePlots object at 0x11c340160>

    @pytest.mark.slow
    def test_if_scatterplot_colorbar_affects_xaxis_visibility(self):
        # addressing issue #10611, to ensure colobar does not
        # interfere with x-axis label and ticklabels with
        # ipython inline backend.
        random_array = np.random.random((1000, 3))
        df = pd.DataFrame(random_array,
                          columns=['A label', 'B label', 'C label'])

        ax1 = df.plot.scatter(x='A label', y='B label')
        ax2 = df.plot.scatter(x='A label', y='B label', c='C label')

        vis1 = [vis.get_visible() for vis in
                ax1.xaxis.get_minorticklabels()]
        vis2 = [vis.get_visible() for vis in
                ax2.xaxis.get_minorticklabels()]
>       assert vis1 == vis2
E       assert [] == [False, False, False, False, False, False, ...]
E         Right contains more items, first extra item: False
E         Use -v to get the full diff

pandas/tests/plotting/test_frame.py:1106: AssertionError
_________________________________________________ TestDataFramePlots.test_if_hexbin_xaxis_label_is_visible _________________________________________________

self = <pandas.tests.plotting.test_frame.TestDataFramePlots object at 0x11918ba58>

    @pytest.mark.slow
    def test_if_hexbin_xaxis_label_is_visible(self):
        # addressing issue #10678, to ensure colobar does not
        # interfere with x-axis label and ticklabels with
        # ipython inline backend.
        random_array = np.random.random((1000, 3))
        df = pd.DataFrame(random_array,
                          columns=['A label', 'B label', 'C label'])

        ax = df.plot.hexbin('A label', 'B label', gridsize=12)
>       assert all(vis.get_visible() for vis in
                   ax.xaxis.get_minorticklabels())
E       assert False
E        +  where False = all(<generator object TestDataFramePlots.test_if_hexbin_xaxis_label_is_visible.<locals>.<genexpr> at 0x11c69c990>)

pandas/tests/plotting/test_frame.py:1127: AssertionError

Our CI will start failing once these hit defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BlockerBlocking issue or pull request for an upcoming releaseDependenciesRequired and optional dependenciesVisualizationplotting

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions