Skip to content

Conversation

@nmartensen
Copy link
Contributor

@nmartensen nmartensen commented Jun 5, 2017

@nmartensen
Copy link
Contributor Author

So this breaks 18 Tests:

  1. test_finder_annual - pandas.tests.plotting.test_datetimelike.TestTSPlot
  2. test_finder_daily - pandas.tests.plotting.test_datetimelike.TestTSPlot
  3. test_finder_hourly - pandas.tests.plotting.test_datetimelike.TestTSPlot
  4. test_finder_minutely - pandas.tests.plotting.test_datetimelike.TestTSPlot
  5. test_finder_monthly - pandas.tests.plotting.test_datetimelike.TestTSPlot
  6. test_finder_quarterly - pandas.tests.plotting.test_datetimelike.TestTSPlot
  7. test_format_timedelta_ticks_narrow - pandas.tests.plotting.test_datetimelike.TestTSPlot
  8. test_format_timedelta_ticks_wide - pandas.tests.plotting.test_datetimelike.TestTSPlot
  9. test_irregular_ts_shared_ax_xlim - pandas.tests.plotting.test_datetimelike.TestTSPlot
  10. test_mixed_freq_regular_first - pandas.tests.plotting.test_datetimelike.TestTSPlot
  11. test_mixed_freq_regular_first_df - pandas.tests.plotting.test_datetimelike.TestTSPlot
  12. test_secondary_y_irregular_ts_xlim - pandas.tests.plotting.test_datetimelike.TestTSPlot
  13. test_secondary_y_non_ts_xlim - pandas.tests.plotting.test_datetimelike.TestTSPlot
  14. test_secondary_y_regular_ts_xlim - pandas.tests.plotting.test_datetimelike.TestTSPlot
  15. test_area_lim - pandas.tests.plotting.test_frame.TestDataFramePlots
  16. test_line_lim - pandas.tests.plotting.test_frame.TestDataFramePlots
  17. test_ts_area_lim - pandas.tests.plotting.test_series.TestSeriesPlots
  18. test_ts_line_lim - pandas.tests.plotting.test_series.TestSeriesPlots

These tests hardcode expectations from previous MPL defaults. It is only the second commit (which allows MPL to apply its new defaults) that breaks the tests. Do they need a second set of expected results depending on which MPL version is used? Or can we simply update the expected results to what current MPL produces?

The existing tests do not yet cover the case of unsorted x axis (the subject of the first commit). This will need new tests. Is a single test sufficient or do we need different instances for datetimelike/DataFrame/Series?

@TomAugspurger TomAugspurger added the Visualization plotting label Jun 6, 2017
@TomAugspurger TomAugspurger added this to the 0.20.3 milestone Jun 6, 2017
@TomAugspurger
Copy link
Contributor

Thanks for this. Your changes look correct.

Do they need a second set of expected results depending on which MPL version is used? Or can we simply update the expected results to what current MPL produces?

I think we test on an old matplotlib (1.3.1) on python 2.7, and the most recent matplotlib otherwise. So yes, ideally we would cover both. If it's excessively difficult, you can raise skiptests for older matplotlibs where nescessary.

Is a single test sufficient or do we need different instances for datetimelike/DataFrame/Series?

I think just a test for line plots covering a few cases

  • Series.plot with unsorted index
  • DataFrame.plot with unsorted index
  • DataFrame.plot(x='x', y='y') with unsorted x

should be sufficient.

We'll also need a release note. If you rebase on master, there should be a docs/source/whatsnew/v0.20.3.txt you can add this to.

@TomAugspurger
Copy link
Contributor

Actually, it's probably best to do this for 0.21.0, not 0.20.3, since the xlim will be now following matplotlib 2's.

@TomAugspurger TomAugspurger modified the milestones: 0.21.0, 0.20.3 Jun 6, 2017
@nmartensen nmartensen force-pushed the master branch 3 times, most recently from e4a7700 to ce6bcb1 Compare June 10, 2017 19:27
@codecov
Copy link

codecov bot commented Jun 10, 2017

Codecov Report

Merging #16600 into master will increase coverage by 0.01%.
The diff coverage is 16.66%.

Impacted file tree graph

@@ Coverage Diff @@ ## master #16600 +/- ## ========================================== + Coverage 90.93% 90.95% +0.01%  ========================================== Files 161 161 Lines 49266 49267 +1 ========================================== + Hits 44801 44810 +9  + Misses 4465 4457 -8
Flag Coverage Δ
#multiple 88.71% <16.66%> (+0.01%) ⬆️
#single 40.22% <0%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/plotting/_tools.py 72.92% <0%> (-6.08%) ⬇️
pandas/plotting/_core.py 82.38% <25%> (+0.46%) ⬆️
pandas/plotting/_converter.py 65.2% <0%> (+1.96%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ceaf852...ce6bcb1. Read the comment docs.

@codecov
Copy link

codecov bot commented Jun 10, 2017

Codecov Report

Merging #16600 into master will decrease coverage by 0.01%.
The diff coverage is 16.66%.

Impacted file tree graph

@@ Coverage Diff @@ ## master #16600 +/- ## ========================================== - Coverage 91.22% 91.2% -0.02%  ========================================== Files 163 163 Lines 49624 49625 +1 ========================================== - Hits 45269 45260 -9  - Misses 4355 4365 +10
Flag Coverage Δ
#multiple 88.99% <16.66%> (-0.01%) ⬇️
#single 40.19% <0%> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/plotting/_tools.py 72.92% <0%> (-6.08%) ⬇️
pandas/plotting/_core.py 82.52% <25%> (-0.21%) ⬇️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.77% <0%> (-0.1%) ⬇️
pandas/plotting/_converter.py 65.2% <0%> (+1.96%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cbb090f...15eae82. Read the comment docs.

@nmartensen
Copy link
Contributor Author

So the codecov decrease in plotting/_tool.py is actually the point of one of the patches – xlims should only be adjusted with older matplotlib.

If you prefer this PR to be split into two (one for wrong xlims and one for MPL xlim defaults), or if you have other comments, let me know.

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Jul 5, 2017

So the codecov decrease...

That may be inaccurate. I don't recall which versions of matplotlib are installed on the runs that report code coverage. It should still be being tested on other runs.

@jreback
Copy link
Contributor

jreback commented Jul 19, 2017

can you rebase / update according to comments

@TomAugspurger
Copy link
Contributor

I think you'll just need a rebase. IIRC, things looked pretty good last time I looked.

@nmartensen
Copy link
Contributor Author

rebased

@jreback
Copy link
Contributor

jreback commented Sep 10, 2017

can you rebase / update once again

Two new tests check interaction of non-monotonic x data and xlims: test_frame / test_unsorted_index_lims test_series / test_unsorted_index_xlim
 * Do not assume that xdata is sorted. * Use numpy.nanmin() and numpy.nanmax() instead.
 * Avoid setting xlims since recent matplotlib already does it correctly * and we should let it apply its default styles where possible
Matplotlib 2.0 uses new defaults that cause some of our tests to fail. This adds appropriate new sets of expected results to the following tests in tests/plotting/test_datetimelike.py: test_finder_daily test_finder_quarterly test_finder_annual test_finder_hourly test_finder_minutely test_finder_monthly test_format_timedelta_ticks_narrow test_format_timedelta_ticks_wide
Matplotlib 2.0 by default now adds some padding between the boundaries of the data and the boundaries of the plot. This causes some of our tests to fail if we don't relax them slightly. modified: pandas/tests/plotting/test_datetimelike.py test_irregular_ts_shared_ax_xlim test_mixed_freq_regular_first test_mixed_freq_regular_first_df test_secondary_y_irregular_ts_xlim test_secondary_y_non_ts_xlim test_secondary_y_regular_ts_xlim modified: pandas/tests/plotting/test_frame.py test_area_lim test_line_lim modified: pandas/tests/plotting/test_series.py test_ts_area_lim test_ts_line_lim
@nmartensen
Copy link
Contributor Author

rebased

@TomAugspurger TomAugspurger merged commit 3795272 into pandas-dev:master Sep 19, 2017
@TomAugspurger
Copy link
Contributor

Thanks @nmartensen! (sorry about the extra rebase)

alanbato pushed a commit to alanbato/pandas that referenced this pull request Nov 10, 2017
* BUG: set correct xlims for lines (pandas-dev#11471, pandas-dev#11310) * Do not assume that xdata is sorted. * Use numpy.nanmin() and numpy.nanmax() instead. * BUG: Let new MPL automatically determine xlims (pandas-dev#15495) * Avoid setting xlims since recent matplotlib already does it correctly * and we should let it apply its default styles where possible * TST: plotting: update expected results for matplotlib 2 Matplotlib 2.0 uses new defaults that cause some of our tests to fail. This adds appropriate new sets of expected results to the following tests in tests/plotting/test_datetimelike.py: test_finder_daily test_finder_quarterly test_finder_annual test_finder_hourly test_finder_minutely test_finder_monthly test_format_timedelta_ticks_narrow test_format_timedelta_ticks_wide * TST: plotting: Relax some tests to work with matplotlib 2.0 Matplotlib 2.0 by default now adds some padding between the boundaries of the data and the boundaries of the plot. This causes some of our tests to fail if we don't relax them slightly. modified: pandas/tests/plotting/test_datetimelike.py test_irregular_ts_shared_ax_xlim test_mixed_freq_regular_first test_mixed_freq_regular_first_df test_secondary_y_irregular_ts_xlim test_secondary_y_non_ts_xlim test_secondary_y_regular_ts_xlim modified: pandas/tests/plotting/test_frame.py test_area_lim test_line_lim modified: pandas/tests/plotting/test_series.py test_ts_area_lim test_ts_line_lim * TST: Add lineplot tests with unsorted x data Two new tests check interaction of non-monotonic x data and xlims: test_frame / test_unsorted_index_lims test_series / test_unsorted_index_xlim * DOC: lineplot/xlims whatsnew entry for v0.21.0
No-Stream pushed a commit to No-Stream/pandas that referenced this pull request Nov 28, 2017
* BUG: set correct xlims for lines (pandas-dev#11471, pandas-dev#11310) * Do not assume that xdata is sorted. * Use numpy.nanmin() and numpy.nanmax() instead. * BUG: Let new MPL automatically determine xlims (pandas-dev#15495) * Avoid setting xlims since recent matplotlib already does it correctly * and we should let it apply its default styles where possible * TST: plotting: update expected results for matplotlib 2 Matplotlib 2.0 uses new defaults that cause some of our tests to fail. This adds appropriate new sets of expected results to the following tests in tests/plotting/test_datetimelike.py: test_finder_daily test_finder_quarterly test_finder_annual test_finder_hourly test_finder_minutely test_finder_monthly test_format_timedelta_ticks_narrow test_format_timedelta_ticks_wide * TST: plotting: Relax some tests to work with matplotlib 2.0 Matplotlib 2.0 by default now adds some padding between the boundaries of the data and the boundaries of the plot. This causes some of our tests to fail if we don't relax them slightly. modified: pandas/tests/plotting/test_datetimelike.py test_irregular_ts_shared_ax_xlim test_mixed_freq_regular_first test_mixed_freq_regular_first_df test_secondary_y_irregular_ts_xlim test_secondary_y_non_ts_xlim test_secondary_y_regular_ts_xlim modified: pandas/tests/plotting/test_frame.py test_area_lim test_line_lim modified: pandas/tests/plotting/test_series.py test_ts_area_lim test_ts_line_lim * TST: Add lineplot tests with unsorted x data Two new tests check interaction of non-monotonic x data and xlims: test_frame / test_unsorted_index_lims test_series / test_unsorted_index_xlim * DOC: lineplot/xlims whatsnew entry for v0.21.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants