Skip to content
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

COMPAT: matplotlib v0.15rc1 issues #11111

Closed
jreback opened this issue Sep 15, 2015 · 48 comments · Fixed by #11145
Closed

COMPAT: matplotlib v0.15rc1 issues #11111

jreback opened this issue Sep 15, 2015 · 48 comments · Fixed by #11145
Labels
Blocker Blocking issue or pull request for an upcoming release Compat pandas objects compatability with Numpy or Python functions Visualization plotting
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Sep 15, 2015

install via: conda install matplotlib -c tacaswell (only linux-64 ATM)

this is with pandas-0.17rc1

......F......E..FF...FE..F./home/jreback/miniconda/envs/pandas/lib/python2.7/site-packages/matplotlib/__init__.py:872: UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.
  warnings.warn(self.msg_depr % (key, alt_key))
/home/jreback/miniconda/envs/pandas/lib/python2.7/site-packages/matplotlib/__init__.py:892: UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.
  warnings.warn(self.msg_depr % (key, alt_key))
...E.../home/jreback/pandas/pandas/tools/plotting.py:3242: UserWarning: To output multiple subplots, the figure containing the passed axes is being cleared
  "is being cleared", UserWarning)
EF......ES.....E.......E.E.........../home/jreback/miniconda/envs/pandas/lib/python2.7/site-packages/matplotlib/artist.py:221: MatplotlibDeprecationWarning: This has been deprecated in mpl 1.5, please use the
axes property.  A removal date has not been set.
  warnings.warn(_get_axes_msg, mplDeprecation, stacklevel=1)
.........FE..E........F.E..E..........E.......................EE.
======================================================================
ERROR: test_bar_colors (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 1810, in test_bar_colors
    self._check_colors(ax.patches[::5], facecolors=default_colors[:5])
TypeError: 'NoneType' object has no attribute '__getitem__'

======================================================================
ERROR: test_boxplot_colors (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 2860, in test_boxplot_colors
    _check_colors(bp, default_colors[0], default_colors[0], default_colors[2])
TypeError: 'NoneType' object has no attribute '__getitem__'

======================================================================
ERROR: test_df_legend_labels (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 2478, in test_df_legend_labels
    ax = df.plot(legend=True, secondary_y='b')
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 3610, in __call__
    sort_columns=sort_columns, **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2495, in plot_frame
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2323, in _plot
    plot_obj.generate()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 944, in generate
    self._make_plot()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1596, in _make_plot
    ax = self._get_ax(i)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1280, in _get_ax
    ax = self._maybe_right_yaxis(ax, i)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 976, in _maybe_right_yaxis
    new_ax._get_lines.color_cycle = orig_ax._get_lines.color_cycle
AttributeError: '_process_plot_var_args' object has no attribute 'color_cycle'

======================================================================
ERROR: test_errorbar_plot (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 3129, in test_errorbar_plot
    df.plot(yerr=df_err)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 3610, in __call__
    sort_columns=sort_columns, **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2495, in plot_frame
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2323, in _plot
    plot_obj.generate()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 944, in generate
    self._make_plot()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1609, in _make_plot
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1623, in _plot
    lines = MPLPlot._plot(ax, x, y_values, style=style, **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1241, in _plot
    return ax.errorbar(x, y, **kwds)
  File "/home/jreback/miniconda/envs/pandas/lib/python2.7/site-packages/matplotlib/__init__.py", line 1806, in inner
    return func(ax, *args, **kwargs)
  File "/home/jreback/miniconda/envs/pandas/lib/python2.7/site-packages/matplotlib/axes/_axes.py", line 2964, in errorbar
    raise ValueError("yerr must be a scalar, the same "
ValueError: yerr must be a scalar, the same dimensions as y, or 2xN.

======================================================================
ERROR: test_hist_colors (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 2737, in test_hist_colors
    self._check_colors(ax.patches[::10], facecolors=default_colors[:5])
TypeError: 'NoneType' object has no attribute '__getitem__'

======================================================================
ERROR: test_kde_colors_and_styles_subplots (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 2799, in test_kde_colors_and_styles_subplots
    for ax, c in zip(axes, list(default_colors)):
TypeError: 'NoneType' object is not iterable

======================================================================
ERROR: test_line_colors_and_styles_subplots (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 2634, in test_line_colors_and_styles_subplots
    for ax, c in zip(axes, list(default_colors)):
TypeError: 'NoneType' object is not iterable

======================================================================
ERROR: test_line_lim (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 1768, in test_line_lim
    ax = df.plot(secondary_y=True)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 3610, in __call__
    sort_columns=sort_columns, **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2495, in plot_frame
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2323, in _plot
    plot_obj.generate()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 944, in generate
    self._make_plot()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1579, in _make_plot
    if self._is_ts_plot():
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1572, in _is_ts_plot
    return not self.x_compat and self.use_index and self._use_dynamic_x()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1576, in _use_dynamic_x
    return _use_dynamic_x(self._get_ax(0), self.data)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1280, in _get_ax
    ax = self._maybe_right_yaxis(ax, i)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 976, in _maybe_right_yaxis
    new_ax._get_lines.color_cycle = orig_ax._get_lines.color_cycle
AttributeError: '_process_plot_var_args' object has no attribute 'color_cycle'

======================================================================
ERROR: test_subplots_dup_columns (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 1668, in test_subplots_dup_columns
    axes = df.plot(subplots=True, secondary_y='a')
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 3610, in __call__
    sort_columns=sort_columns, **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2495, in plot_frame
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2323, in _plot
    plot_obj.generate()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 944, in generate
    self._make_plot()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1579, in _make_plot
    if self._is_ts_plot():
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1572, in _is_ts_plot
    return not self.x_compat and self.use_index and self._use_dynamic_x()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1576, in _use_dynamic_x
    return _use_dynamic_x(self._get_ax(0), self.data)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1276, in _get_ax
    ax = self._maybe_right_yaxis(ax, i)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 976, in _maybe_right_yaxis
    new_ax._get_lines.color_cycle = orig_ax._get_lines.color_cycle
AttributeError: '_process_plot_var_args' object has no attribute 'color_cycle'

======================================================================
ERROR: test_subplots_sharex_axes_existing_axes (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 1651, in test_subplots_sharex_axes_existing_axes
    df['C'].plot(ax=axes[0], secondary_y=True)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 3436, in __call__
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2526, in plot_series
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2323, in _plot
    plot_obj.generate()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 944, in generate
    self._make_plot()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1579, in _make_plot
    if self._is_ts_plot():
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1572, in _is_ts_plot
    return not self.x_compat and self.use_index and self._use_dynamic_x()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1576, in _use_dynamic_x
    return _use_dynamic_x(self._get_ax(0), self.data)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1280, in _get_ax
    ax = self._maybe_right_yaxis(ax, i)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 976, in _maybe_right_yaxis
    new_ax._get_lines.color_cycle = orig_ax._get_lines.color_cycle
AttributeError: '_process_plot_var_args' object has no attribute 'color_cycle'

======================================================================
ERROR: test_df_series_secondary_legend (pandas.tests.test_graphics.TestSeriesPlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 889, in test_df_series_secondary_legend
    s.plot(legend=True, secondary_y=True)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 3436, in __call__
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2526, in plot_series
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2323, in _plot
    plot_obj.generate()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 944, in generate
    self._make_plot()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1579, in _make_plot
    if self._is_ts_plot():
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1572, in _is_ts_plot
    return not self.x_compat and self.use_index and self._use_dynamic_x()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1576, in _use_dynamic_x
    return _use_dynamic_x(self._get_ax(0), self.data)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1280, in _get_ax
    ax = self._maybe_right_yaxis(ax, i)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 976, in _maybe_right_yaxis
    new_ax._get_lines.color_cycle = orig_ax._get_lines.color_cycle
AttributeError: '_process_plot_var_args' object has no attribute 'color_cycle'

======================================================================
ERROR: test_errorbar_plot (pandas.tests.test_graphics.TestSeriesPlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 1113, in test_errorbar_plot
    s.plot(yerr=s_err)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 3436, in __call__
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2526, in plot_series
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2323, in _plot
    plot_obj.generate()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 944, in generate
    self._make_plot()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1609, in _make_plot
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1623, in _plot
    lines = MPLPlot._plot(ax, x, y_values, style=style, **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1241, in _plot
    return ax.errorbar(x, y, **kwds)
  File "/home/jreback/miniconda/envs/pandas/lib/python2.7/site-packages/matplotlib/__init__.py", line 1806, in inner
    return func(ax, *args, **kwargs)
  File "/home/jreback/miniconda/envs/pandas/lib/python2.7/site-packages/matplotlib/axes/_axes.py", line 2964, in errorbar
    raise ValueError("yerr must be a scalar, the same "
ValueError: yerr must be a scalar, the same dimensions as y, or 2xN.

======================================================================
ERROR: test_hist_secondary_legend (pandas.tests.test_graphics.TestSeriesPlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 852, in test_hist_secondary_legend
    df['b'].plot.hist(ax=ax, legend=True, secondary_y=True)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 3524, in hist
    return self(kind='hist', bins=bins, **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 3436, in __call__
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2526, in plot_series
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2323, in _plot
    plot_obj.generate()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 944, in generate
    self._make_plot()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1948, in _make_plot
    ax = self._get_ax(i)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1280, in _get_ax
    ax = self._maybe_right_yaxis(ax, i)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 976, in _maybe_right_yaxis
    new_ax._get_lines.color_cycle = orig_ax._get_lines.color_cycle
AttributeError: '_process_plot_var_args' object has no attribute 'color_cycle'

======================================================================
ERROR: test_ts_area_lim (pandas.tests.test_graphics.TestSeriesPlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 582, in test_ts_area_lim
    ax = tz_ts.plot.area(stacked=False, secondary_y=True)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 3560, in area
    return self(kind='area', **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 3436, in __call__
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2526, in plot_series
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2323, in _plot
    plot_obj.generate()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 944, in generate
    self._make_plot()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1579, in _make_plot
    if self._is_ts_plot():
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1572, in _is_ts_plot
    return not self.x_compat and self.use_index and self._use_dynamic_x()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1576, in _use_dynamic_x
    return _use_dynamic_x(self._get_ax(0), self.data)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1280, in _get_ax
    ax = self._maybe_right_yaxis(ax, i)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 976, in _maybe_right_yaxis
    new_ax._get_lines.color_cycle = orig_ax._get_lines.color_cycle
AttributeError: '_process_plot_var_args' object has no attribute 'color_cycle'

======================================================================
ERROR: test_ts_line_lim (pandas.tests.test_graphics.TestSeriesPlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 551, in test_ts_line_lim
    ax = self.ts.plot(secondary_y=True)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 3436, in __call__
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2526, in plot_series
    **kwds)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 2323, in _plot
    plot_obj.generate()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 944, in generate
    self._make_plot()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1579, in _make_plot
    if self._is_ts_plot():
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1572, in _is_ts_plot
    return not self.x_compat and self.use_index and self._use_dynamic_x()
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1576, in _use_dynamic_x
    return _use_dynamic_x(self._get_ax(0), self.data)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 1280, in _get_ax
    ax = self._maybe_right_yaxis(ax, i)
  File "/home/jreback/pandas/pandas/tools/plotting.py", line 976, in _maybe_right_yaxis
    new_ax._get_lines.color_cycle = orig_ax._get_lines.color_cycle
AttributeError: '_process_plot_var_args' object has no attribute 'color_cycle'

======================================================================
FAIL: test_area_colors (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 2701, in test_area_colors
    self._check_colors(handles, linecolors=custom_colors)
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 194, in _check_colors
    self.assertEqual(len(collections), len(linecolors))
AssertionError: 10 != 5

======================================================================
FAIL: test_bar_log_no_subplots (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 2188, in test_bar_log_no_subplots
    tm.assert_numpy_array_equal(ax.yaxis.get_ticklocs(), expected)
  File "/home/jreback/pandas/pandas/util/testing.py", line 822, in assert_numpy_array_equal
    left.shape, right.shape)
  File "/home/jreback/pandas/pandas/util/testing.py", line 791, in raise_assert_detail
    raise AssertionError(msg)
AssertionError: numpy array are different

numpy array shapes are different
[left]:  (4,)
[right]: (2,)

======================================================================
FAIL: test_bar_log_subplots (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 2199, in test_bar_log_subplots
    tm.assert_numpy_array_equal(ax[0].yaxis.get_ticklocs(), expected)
  File "/home/jreback/pandas/pandas/util/testing.py", line 822, in assert_numpy_array_equal
    left.shape, right.shape)
  File "/home/jreback/pandas/pandas/util/testing.py", line 791, in raise_assert_detail
    raise AssertionError(msg)
AssertionError: numpy array are different

numpy array shapes are different
[left]:  (6,)
[right]: (4,)

======================================================================
FAIL: test_boxplot (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 2214, in test_boxplot
    self.bp_n_objects * len(numeric_cols))
AssertionError: 21 != 24

======================================================================
FAIL: test_boxplot_vertical (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 2251, in test_boxplot_vertical
    self.assertEqual(len(ax.lines), self.bp_n_objects * len(numeric_cols))
AssertionError: 21 != 24

======================================================================
FAIL: test_errorbar_scatter (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 3251, in test_errorbar_scatter
    _check_errorbar_color(ax.containers, 'green', has_err='has_yerr')
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 3240, in _check_errorbar_color
    self._check_colors(errs, linecolors=[expected] * len(errs))
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 204, in _check_colors
    self.assertEqual(result, expected)
AssertionError: Tuples differ: (0.0, 0.0, 1.0, 1.0) != (0.0, 0.5019607843137255, 0.0,...

First differing element 1:
0.0
0.501960784314

- (0.0, 0.0, 1.0, 1.0)
+ (0.0, 0.5019607843137255, 0.0, 1.0)

======================================================================
FAIL: test_subplots (pandas.tests.test_graphics.TestDataFramePlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 1440, in test_subplots
    self._check_legend_labels(ax, labels=[com.pprint_thing(column)])
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 117, in _check_legend_labels
    self._check_text_labels(ax.get_legend().get_texts(), labels)
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 241, in _check_text_labels
    self.assertEqual(len(labels), len(expected))
AssertionError: 2 != 1

======================================================================
FAIL: test_bar_log (pandas.tests.test_graphics.TestSeriesPlots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jreback/pandas/pandas/tests/test_graphics.py", line 649, in test_bar_log
    tm.assert_numpy_array_equal(ax.yaxis.get_ticklocs(), expected)
  File "/home/jreback/pandas/pandas/util/testing.py", line 822, in assert_numpy_array_equal
    left.shape, right.shape)
  File "/home/jreback/pandas/pandas/util/testing.py", line 791, in raise_assert_detail
    raise AssertionError(msg)
AssertionError: numpy array are different

numpy array shapes are different
[left]:  (6,)
[right]: (4,)

----------------------------------------------------------------------
Ran 136 tests in 124.794s

FAILED (SKIP=1, errors=15, failures=8)

cc @TomAugspurger @sinhrks @jorisvandenbossche
cc @tacaswell

@jreback jreback added Visualization plotting Compat pandas objects compatability with Numpy or Python functions Blocker Blocking issue or pull request for an upcoming release labels Sep 15, 2015
@jreback jreback added this to the 0.17.0 milestone Sep 15, 2015
@tacaswell
Copy link
Contributor

attn @WeatherGod

Some if not most of this should be handled on our end.

@tacaswell
Copy link
Contributor

Although, some if this looks like you are reaching in and touching mpl guts in ways that you probably should not be.

@TomAugspurger
Copy link
Contributor

@tacaswell let us know which ones those are if you can. I can put in some fixups before we release 0.17.

@TomAugspurger
Copy link
Contributor

Also, could you share your linux conda recipe? I can build and upload an OSX version.

@tacaswell
Copy link
Contributor

@jreback
Copy link
Contributor Author

jreback commented Sep 15, 2015

fyi, you can easily make this install on travis, e.g. add:

conda config --add channels tacaswell || exit 1

right before here

this will add to all builds that don't explicity specify things.

@WeatherGod
Copy link

We probably should fix the very first one (ax.patches should always be iterable and never None).

As for the color cycle issue... sigh...
You guys know better than this. You know that underscored objects are treated as private. Furthermore, what you are doing is dangerous in the first place because you are now sharing iterators among multiple axes objects, possibly leading to all sorts of weirdness.

I don't know how we should address this. cycling completely changed in 1.5, and I relied on the fact that the internal implementation was private in order to do it. I appreciate the fact that older versions of pandas will be completely incompatible with matplotlib v1.5, but even if I were to jury-rig color_cycle back into those objects, it still wouldn't work correctly because it is copying the wrong information. Anybody who is using the new cycler features to cycle more than just colors will have their property cycles blown away by pandas setting of just the color portion of the cycle.

@TomAugspurger
Copy link
Contributor

I don't think you should have to mess up matpltolib's code base just because a downstream library made some bad choices (even one as big as pandas).

Thinking through the options on the pandas... we can detect the matplotlib version and work around the cycling changes. I'll look through how much work that will be tonight. My first priority is to get pandas 0.17+ and matplotlib 1.5+ working together correctly.

@WeatherGod
Copy link

just make sure you use ax.{get,set}_prop_cycle, please?

@TomAugspurger
Copy link
Contributor

Will do!

xref: matplotlib/matplotlib#4686

@tacaswell
Copy link
Contributor

Sorry I didn't get to come back around to this tonight, please ping me or @WeatherGod (sorry for volunteering you Ben) if you have any questions!

@TomAugspurger
Copy link
Contributor

I do have one question. Is there a way to know where in a (color) cycle an axes is at? The use case here is, given an axes with a line already, add a second line to the same figure, with a secondary y axis (via twinx).

In [13]: df = pd.DataFrame(np.random.randn(10, 2))

In [14]: ax = df[[0]].plot(ax=ax)

In [15]: plt.close()

In [16]: fig, ax = plt.subplots()

In [17]: df[[0]].plot(ax=ax)
Out[17]: <matplotlib.axes._subplots.AxesSubplot at 0x115c4d198>

In [18]: df[[1]].plot(ax=ax, secondary_y=True)
Out[18]: <matplotlib.axes._subplots.AxesSubplot at 0x115b3e978>

More specifically, we need a way to answer "if I'm at this color, what's the next color in the user's cycle?".

@WeatherGod
Copy link

Sounds like a use for tee(), but there is currently no way to access the
raw iterator without accessing private stuff. You are going to need a
feature added for that, and I am not sure how it should be done that
doesn't lock us into the horrendous arg-parsing objects we have...

We might be able to get away with tee()-ing the private iterators ourselves
in twinx(), at least as a stop-gap solution.
On Sep 15, 2015 11:47 PM, "Tom Augspurger" [email protected] wrote:

I do have one question. Is there a way to know where in a (color) cycle an
axes is at? The use case here is, given an axes with a line already, add
a second line to the same figure, with a secondary y axis (via twinx).

In [13]: df = pd.DataFrame(np.random.randn(10, 2))

In [14]: ax = df[[0]].plot(ax=ax)

In [15]: plt.close()

In [16]: fig, ax = plt.subplots()

In [17]: df[[0]].plot(ax=ax)
Out[17]: <matplotlib.axes._subplots.AxesSubplot at 0x115c4d198>

In [18]: df[[1]].plot(ax=ax, secondary_y=True)
Out[18]: <matplotlib.axes._subplots.AxesSubplot at 0x115b3e978>

More specifically, we need a way to say "if I'm at this color, what's the
next color in the user's cycle".


Reply to this email directly or view it on GitHub
#11111 (comment).

@TomAugspurger
Copy link
Contributor

My current, not well-thought out approach is the get the last color used on the original axis, cycler thru rc.Params['axes.prop_cycle']'s color cycle until I hit the last color, and slice that cycler from there + 1.

            cyl = plt.rcParams['axes.prop_cycle']
            last = orig_ax.lines()[-1].get_color()

            try:
                offset = [v['color'] for v in cyl].index(last) + 1
                cyl = cyl[offset:]
            except ValueError:
                pass

No idea if it will work yet. This is made more difficult by how we implement secondary_y, which could be refactored.

@TomAugspurger
Copy link
Contributor

Hmm that won't work since cycles can have repeat colors. cycler.cycler('color', ['b', 'b', 'k', 'k']).

@tacaswell
Copy link
Contributor

@WeatherGod I don't think we want tee here, I think we just need the axes to share the underlying iterator between the axes.

@tacaswell
Copy link
Contributor

So, it still involves touching our internals, but

fig, ax = plt.subplots()
ax2 = ax.twinx()
ax2._get_lines = ax._get_lines
ax2._get_patches_for_fill = ax._get_patches_for_fill

If this actually solves the problem we can add a method ax.share_prop_cycle(other_ax)

@TomAugspurger
Copy link
Contributor

@tacaswell thanks, that fixed that class of error.

Having some way to share cyclers between multiple axes (probably on the same fig) does seem useful, at lest for this specific case. If you do end up implementing a public way of doing this let me know and I'll replace this code.

@TomAugspurger
Copy link
Contributor

@tacaswell seeing this warning

MatplotlibDeprecationWarning: This has been deprecated in mpl 1.5, please use the
axes property.  A removal date has not been set.

quite a bit. I'll make this switches to use ax.axes where we have ax.get_axes(), but some are coming from ax.properties(), which calls ax.get_axes() internally. Want me to raise a matplotlib issue for that? pandas got a lot of flack for having an unavoidable warning once.

@tacaswell
Copy link
Contributor

Yes please re axes issue

@TomAugspurger
Copy link
Contributor

Yes please re axes issue

Raised at matplotlib/matplotlib#5089

@TomAugspurger
Copy link
Contributor

@tacaswell not sure how you want to handle the failure in test_errorbar_plot. A smaller example is

import numpy as np
import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.errorbar(np.arange(12), np.arange(12), yerr=['zzz'] * 12)

As of matplotlib 1.4.3 that raised a TypeError when we subtracted an int from a str. In 1.5 that's a TypeError: yerr must be a scalar, the same dimensions as y, or 2xN.

It does seem somewhat strange that the above raises a TypeError, while ax.errorbar(np.arange(12), np.arange(12), yerr=['z'] * 12) (a list w/ 12 single 'z's) raises the old ValurError. I don't really have any idea why we test this though.

@TomAugspurger
Copy link
Contributor

I also did a quick search for us doing stuff with non-public methods. Didn't find any more of those, but we do occasionally attach extra data to axes objects,

  • ax._plot_data for (some?all?) timeseries plots (plot with a DatetimeIndex)
  • ax._stacker_{neg/pos}_prior for stacked bar/area plots

sorry 😰 perhaps we should prefix all these with a pandas prefix

@TomAugspurger
Copy link
Contributor

Our failure in pandas.tests.test_graphics.TestDataFramePlots.test_area_colors comes from a behavior change, when plotting a new item with the same label.

import numpy as np
import matplotlib.pyplot as plt

fig, ax = plt.subplots()
x = np.arange(4)
y0 = np.zeros(4)
y1 = np.arange(4)
ax.plot(x, y1, label='a')
ax.fill_between(x, y0, y1, label='a')
print(ax.get_legend_handle_labels())

on mpl 1.43 this is ([<matplotlib.lines.Line2D at 0x11938bda0>], ['a']), so just one item (the line)

and with 1.5 it's both ([<matplotlib.lines.Line2D object at 0x10dd854e0>, <matplotlib.collections.PolyCollection object at 0x10dd856a0>], ['a', 'a'])

If that's an intended change I'll just amend our test.

EDIT: Seems like this is the change: http://matplotlib.org/devdocs/users/whats_new.html#support-for-legend-for-polycollection-and-stackplot

@TomAugspurger
Copy link
Contributor

The failures from ones like test_bar_log_no_subplots aren't real. They came from matplolib dev's __version__ being 0+unknown. We've got some tests that check for matplotlib <= 1.2.

@tacaswell
Copy link
Contributor

How are you installing mpl? We just switched to using versioneer and apparently still have some kinks to work out.

@TomAugspurger
Copy link
Contributor

Cloned repo, checked out the 1.5rc tag, and built with python setup.py build && python setup.py install.

@tacaswell
Copy link
Contributor

attn @pelson re versioneer issues

@TomAugspurger
Copy link
Contributor

OK, a PR is coming shortly.

Here are the source of the failures / errors

  1. rcParams['axes.color_cycle'] -> rcParams['axes.prop_cycle']
  2. errobar with string-likes used to raise ValueError, now a TypeError (sometimes, depending on length of string)
  3. ax.get_children() might have additional items in it now
  4. strangeness with .plot(c=thing, color=thing) Was warning about scalar comparison earlier, need to investigate more.
  5. Our area plot (which uses fill_between) is having a legend added to the label
  6. strangeness with ts.plot(secondary_y=True) axes not having the .freq
  7. scatter colorbar label

1-3 I've altered the tests to either find / check for the correct thign.
4 is odd, and I'm not sure it was fully working earlier. Need to look into this more. I have no idea how it even worked with matplotlib 1.4.3.
5 was I'm assuming intentional on matplotlib's part.
6 is probably our fault. We attach a .freq attribute directly to the axes when plotting timeseries.
7. Was us using another non-public method, but at least there was a comment noting that :) Is there a good way to get the label attached to a colorbar?

EDIT: nevermind on the last one. That was under a block checking if matplotlib was >= 1.3.1, which failed cause the versioneer problems.

@tacaswell
Copy link
Contributor

5 was intentional, you have an open issue about it where I volunteered to fix it and never got to it... #9161

I think 2 should be investigated on the mpl side and the old behavior restored, or at least always raise the same exception.

3 was intentional.

@pelson
Copy link

pelson commented Sep 18, 2015

Also, could you share your linux conda recipe? I can build and upload an OSX version.

I've actually been working to get the matplotlib rc building automatically on OSX, Liunx and Windows using conda with some success (there are still some holes in the build matrix though). It might be a nice way to have easy building of Pandas' release candidate as well. Pretty early days, but take a look at : https://github.com/conda-forge/staged-recipes/tree/matplotlib_partly/recipes

Cloned repo, checked out the 1.5rc tag, and built with python setup.py build && python setup.py install.

Strange, this works for me:

pelson@~/dev/matplotlib> git co v1.5.0rc1
pelson@~/dev/matplotlib> python setup.py info
============================================================================

BUILDING MATPLOTLIB
            matplotlib: yes [1.5.0rc1]
                python: yes [2.7.10 |Continuum Analytics, Inc.| (default,
                        Sep 15 2015, 14:29:08)  [GCC 4.2.1 (Apple Inc. build
                        5577)]]
              platform: yes [darwin]
...

Are you getting the version correctly in the header? If so, we are missing a step elsewhere. If not, what is your version of git?

@TomAugspurger
Copy link
Contributor

setup.py info:

============================================================================
Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
            matplotlib: yes [1.5.0rc1]
                python: yes [3.4.3 (default, Jul 13 2015, 12:18:23)  [GCC
                        4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)]]
              platform: yes [darwin]

so we're good there. Git version 2.5.2;


I don't have time to dig into it now, but here's what versioneer sees,

In [51]: git_versions_from_keywords(get_keywords(), cfg.tag_prefix, True)
keywords are unexpanded, not using
---------------------------------------------------------------------------

So it moves on to

In [52]: root = os.path.realpath("lib/matplotlib/_version.py")

In [53]:         for i in cfg.versionfile_source.split('/'):
   ....:                 root = os.path.dirname(root)
   ....:

In [54]: root
Out[54]: '/Users/tom.augspurger/Envs/dev/lib/python3.4/site-packages/matplotlib'

In [55]: git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-55-051801b9ad10> in <module>()
----> 1 git_pieces_from_vcs(cfg.tag_prefix, root, verbose)

NameError: name 'verbose' is not defined

In [56]: git_pieces_from_vcs(cfg.tag_prefix, root, True)
Out[56]:
{'closest-tag': '1.5.0rc1',
 'dirty': False,
 'distance': 0,
 'error': None,
 'long': 'ab00a04759f5460f4d2176430594ec194d6f624b',
 'short': 'ab00a04'}

In [57]: render(git_pieces_from_vcs(cfg.tag_prefix, root, True), cfg.style)
Out[57]:
{'dirty': False,
 'error': None,
 'full-revisionid': 'ab00a04759f5460f4d2176430594ec194d6f624b',
 'version': '1.5.0rc1'}

which seems to be correct, but

In [58]: matplotlib.__version__
Out[58]: '0+unknown'

@TomAugspurger
Copy link
Contributor

Thinking out loud here a bit.

My remaining failure is coming from our time series plotting. We set an attribute freqon the axes indicating the frequency of the Timeseries. There's a path through matplotlib code, and along the way the axes changes (the actual memory address changes), so our custom .freq is gone. Eventually that matplotlib code ends up calling back into pandas code when it goes to update the units. At this point pandas raises a TypeError since the .freq attribute isn't there when we look for it.

I know I said earlier that matplotlib shouldn't have to muck up it's code because pandas wasn't doing things properly. But I might ask for a special case here. The reason (at least a reason) we go through all this is to support interactively plotting multiple timeseries, possibly of different frequency. We need some way to communicate the frequency to the newly plotted timeseries, in case it has to be resampled to the original timeseries' frequency. I'm not sure there's a way to do that without attaching some information to the axes.

The strange thing is that this only fails when we twinx. I need to figure out why that is; we may not have to touch matplotlib at all.

@TomAugspurger
Copy link
Contributor

Should have seen this last night. When we

ax2 = ax.twinx()
ax2._get_lines = ax._get_lines

ax2.get_lnies.axes points to ax, not ax2, which is why my axes changed in matplotlib code. I'm digging our technical debt hole a bit deeper, and just setting the .freq attribute on both axes when secondary_y is True.


@tacaswell working on a smaller example, but in pandas.tseries.test_plotting:TestTSPlots.test_gap_upsample, ax.get_lines()[0].get_xydata() used to return a numpy MaskedArray, now it seems to return a regular numpy array. Trying to figure out if that's a change from me or from matplotlib.

@TomAugspurger
Copy link
Contributor

On the last failure, where before we got back numpy masked array:

        low = tm.makeTimeSeries()
        low[5:25] = np.nan
        ax = low.plot()
        lines = ax.get_lines()
        l = lines[0]
        data = l.get_xydata()
        tm.assertIsInstance(data, np.ma.core.MaskedArray)
        mask = data.mask
        self.assertTrue(mask[5:25, 1].all())
pandas matplotlib result
master 1.4.3 ✔️
master 1.5.0
mpl1.5-compat 1.5.0

So I think this is a change in matplotlib. I should say that visually things are identical. But for now I"m just going to change our tests.

@tacaswell
Copy link
Contributor

That is a change on our side, we are moving towards arrays filled with np.nan when possible internally, is that a problem for pandas?

@TomAugspurger
Copy link
Contributor

We explicitly tested for it, but it's not actually relied upon anywhere (AFAIK), so it shouldn't be a problem.

@TomAugspurger
Copy link
Contributor

@tacaswell sorry, one more MPL change that I missed.

This is when you ax.scatter with a c and a color. I'm looking into how we got into this state passing this arguments.

import numpy as np
import matplotlib.pyplot as plt
import matplotlib

x = y = np.arange(4)
c = 'b'
color = 'green'h

fig, ax = plt.subplots()
sc = ax.scatter(x, y, c=c, color=color)

print(matplotlib.__version__, sc.get_facecolor()[0])
MPL 1.4.3: [ 0.          0.50196078  0.          1.        ]
MPL 1.5:   [ 0.  0.  1.  1.]

@tacaswell
Copy link
Contributor

The scatter change is from matplotlib/matplotlib#4079

@jreback
Copy link
Contributor Author

jreback commented Sep 22, 2015

@tacaswell didn't someone put up windows builds on conda-forge? (nothing there now, but I recall the discussion). or are they a different channel?

@jreback
Copy link
Contributor Author

jreback commented Sep 22, 2015

(py3.3)bash-3.2$ conda search "matplotlib=1.5*" -c conda-forge --spec --platform osx-64 --override-channels
Fetching package metadata: ..
matplotlib                   1.5.0rc1             np19py34_0  conda-forge     
                             1.5.0rc1             np19py27_0  conda-forge     
                             1.5.0rc1             np18py34_0  conda-forge     
                             1.5.0rc1             np18py27_0  conda-forge     
(py3.3)bash-3.2$ conda search "matplotlib=1.5*" -c conda-forge --spec --platform linux-64 --override-channels
Fetching package metadata: ..
matplotlib                   1.5.0rc1             np19py34_0  conda-forge     
                             1.5.0rc1             np19py27_0  conda-forge     
                             1.5.0rc1             np18py34_0  conda-forge     
                             1.5.0rc1             np18py27_0  conda-forge     
(py3.3)bash-3.2$ conda search "matplotlib=1.5*" -c conda-forge --spec --platform win-64 --override-channels
Fetching package metadata: ..

@tacaswell
Copy link
Contributor

There are only win 32 builds

✔ ~ 
10:09 $ conda search "matplotlib=1.5*" -c conda-forge --spec --platform win-32 --override-channels
Fetching package metadata: ..
matplotlib                   1.5.0rc1             np19py27_0  conda-forge     
                             1.5.0rc1             np18py27_0  conda-forge  

@jreback
Copy link
Contributor Author

jreback commented Sep 22, 2015

aha!

can someone put up the -64 ones?

@pelson
Copy link

pelson commented Sep 22, 2015

can someone put up the -64 ones?

Yes. I need to fix a bug, but watch this space.

@pelson
Copy link

pelson commented Sep 22, 2015

Not sure how much the logs are visible, but the build is under way: https://ci.appveyor.com/project/pelson/staged-recipes/build/1.0.24
Otherwise you can keep an eye on https://anaconda.org/conda-forge/matplotlib/files as they come in.

@jreback
Copy link
Contributor Author

jreback commented Sep 22, 2015

@pelson awesome! thanks!

@pelson
Copy link

pelson commented Sep 22, 2015

Otherwise you can keep an eye on https://anaconda.org/conda-forge/matplotlib/files as they come in.

Ahh, a couple of compiler issues for win64. I'll try to track them down in conda-forge/staged-recipes#7. Sadly, I wont be able to do that for ~14 hours.

@jreback
Copy link
Contributor Author

jreback commented Sep 22, 2015

@pelson no prob. ping when you are ready. I just want to test our pandas fixes for the rc1 on windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocker Blocking issue or pull request for an upcoming release Compat pandas objects compatability with Numpy or Python functions Visualization plotting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants