Skip to content

Fix Scatter plot datetime and Axis #12949

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
wants to merge 6 commits into from
Closed

Fix Scatter plot datetime and Axis #12949

wants to merge 6 commits into from

Conversation

nparley
Copy link
Contributor

@nparley nparley commented Apr 21, 2016

closes #10611
closes #8113
closes #10678

  • tests added / passed
  • passes git diff upstream/master | flake8 --diff
  • whatsnew entry

This is a first go at trying to fix the above problems. I have created two before and after notebooks here: https://gist.github.com/nparley/08c81672b0e3d7d85b00694a671f57ad

@jreback
Copy link
Contributor

jreback commented Apr 21, 2016

@TomAugspurger @sinhrks

def __init__(self, data, x, y, **kwargs):
MPLPlot.__init__(self, data, **kwargs)
def __init__(self, data, x, y, sharex=False, **kwargs):
if sharex is None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To apply the same fix to hexbin, pls move the logic to PlanePlot. And I think sharex should be always False because we don't support scatter subplots ATM?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sinhrks This is in PlanePlot

@jreback
Copy link
Contributor

jreback commented May 20, 2016

can you rebase / update

@codecov-io
Copy link

codecov-io commented May 20, 2016

Codecov Report

Merging #12949 into master will decrease coverage by <.01%.
The diff coverage is 73.07%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12949      +/-   ##
==========================================
- Coverage      91%      91%   -0.01%     
==========================================
  Files         145      145              
  Lines       49576    49605      +29     
==========================================
+ Hits        45119    45142      +23     
- Misses       4457     4463       +6
Flag Coverage Δ
#multiple 88.77% <73.07%> (-0.01%) ⬇️
#single 40.56% <15.38%> (-0.02%) ⬇️
Impacted Files Coverage Δ
pandas/core/internals.py 93.55% <100%> (ø) ⬆️
pandas/core/generic.py 96.26% <100%> (ø) ⬆️
pandas/tools/plotting.py 71.72% <66.66%> (-0.04%) ⬇️
pandas/core/categorical.py 95.85% <0%> (ø) ⬆️
pandas/core/base.py 95.51% <0%> (ø) ⬆️
pandas/core/series.py 94.89% <0%> (ø) ⬆️
pandas/core/algorithms.py 94.57% <0%> (+0.04%) ⬆️

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 56c2019...cbf3c73. Read the comment docs.

@jorisvandenbossche
Copy link
Member

@TomAugspurger @sinhrks What's the status of this?

@sinhrks
Copy link
Member

sinhrks commented Aug 13, 2016

@nparley can u update to fix above points and add tests?

@nparley
Copy link
Contributor Author

nparley commented Aug 13, 2016

Yes sorry I have a go at bringing this up to date

@nparley
Copy link
Contributor Author

nparley commented Aug 15, 2016

@sinhrks I have moved the login into the PlanePlot class. What stops this working for hexbin is that I have only overridded _compute_plot_data in ScatterPlot and not in PlanePlot. This is because hexbin seems to overflow if you just send it a date. To get hexbin working with dates would need the dates to be converted to numbers and then the axis formatted.

@nparley
Copy link
Contributor Author

nparley commented Aug 16, 2016

This is actually passing I think there was a bit of a travis problem with the latest run (https://travis-ci.org/nparley/pandas/builds/152366202)

@jreback
Copy link
Contributor

jreback commented Sep 9, 2016

can you rebase / update?

@nparley
Copy link
Contributor Author

nparley commented Sep 10, 2016

@jreback this seems to be failing the lint but not in a file related to this PR https://travis-ci.org/nparley/pandas/jobs/158939635 that I can see?

Maybe #14198 will fix the lint error.

@jreback
Copy link
Contributor

jreback commented Sep 10, 2016

flake is too strict here - maybe the version changed or something

it's not comparing case

@nparley
Copy link
Contributor Author

nparley commented Sep 10, 2016

Line 685 and 690 are both key '2000q4' it's line 681 which is the different case '2000Q4'.

@jreback
Copy link
Contributor

jreback commented Sep 10, 2016

@nparley hmm, you are right. but it doesn't fail flaking. can you get it to fail on travis (and then fix)?

@jreback
Copy link
Contributor

jreback commented Sep 10, 2016

prob need to specify that option in setup.cfg to make it active

@nparley
Copy link
Contributor Author

nparley commented Sep 10, 2016

Taking out the duplicate line as I did in that #14198 seems to pass locally and on travis. I installed a clean flake8 about 2 hours a go. This was linting locally on my PC while doing the #14198.

linting -> pandas/tseries
pandas/tseries/tests/test_tslib.py:685:18: F999 dictionary key '2000q4' repeated with different values
pandas/tseries/tests/test_tslib.py:690:18: F999 dictionary key '2000q4' repeated with different values
linting -> pandas/tests

to

linting -> pandas/compat
linting -> pandas/sparse
linting -> pandas/tools
linting -> pandas/tseries
linting -> pandas/tests
linting -> pandas/computation
linting -> pandas/util

@jreback
Copy link
Contributor

jreback commented Sep 10, 2016

its doesn't fail on travis, so not sure what the difference is.

@nparley
Copy link
Contributor Author

nparley commented Sep 10, 2016

It did not pass on travis for me. This is the current master run on my own travis 2 hours a go: https://travis-ci.org/nparley/pandas/builds/158958462 and this is with that duplicate line removed https://travis-ci.org/nparley/pandas/builds/158959215

@jreback
Copy link
Contributor

jreback commented Sep 10, 2016

https://travis-ci.org/pydata/pandas/builds/158970327 here is master, just passed.

make sure you are rebased.

@nparley
Copy link
Contributor Author

nparley commented Sep 10, 2016

Rebased hopefully

@jreback
Copy link
Contributor

jreback commented Nov 22, 2016

status of this?

@nparley
Copy link
Contributor Author

nparley commented Nov 22, 2016

I think it's awaiting feedback to see if anything else needs to be added. I updated the PR after the first comments. I.e. I don't think it's waiting for anything my end.

@jorisvandenbossche
Copy link
Member

@nparley can you add tests for each of the issues that this would close?

@jreback
Copy link
Contributor

jreback commented Jan 21, 2017

@nparley can you update and respond to comments?

@jreback
Copy link
Contributor

jreback commented Mar 20, 2017

@nparley can you rebase / update

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nparley Can you also add some tests for this?

@@ -3289,6 +3289,16 @@ def get_numeric_data(self, copy=False):
self._consolidate_inplace()
return self.combine([b for b in self.blocks if b.is_numeric], copy)

def get_dt_data(self, copy=False):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would call this get_datetime_data

@@ -1574,6 +1577,31 @@ def _post_plot_logic(self, ax, data):
ax.set_ylabel(pprint_thing(y))
ax.set_xlabel(pprint_thing(x))

def _compute_plot_data_with_dt(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is only called in _compute_plot_data in ScatterPlot, why not just putting the code in that function?

def __init__(self, data, x, y, sharex=False, **kwargs):
if sharex is None:
# Fix x axis color bar problems
sharex = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sharex fix, is this independent from the datetime fix?
If so, can you make a separate PR for it?

@nparley
Copy link
Contributor Author

nparley commented Apr 9, 2017

Hi Guys, I think this PR is probably quite stale now. My development work is not touching pandas that much unfortunately and I don't really have that much time currently. Maybe some of the ideas can be moved into a more active PR if they are still applicable? I have tired to rebase and address the comments above to clean things up but have not tested the latest commit.

@jreback
Copy link
Contributor

jreback commented May 13, 2017

would need a rebase

@jreback
Copy link
Contributor

jreback commented Aug 1, 2017

closing as stale. if you want to re-visit, pls comment and we can re-open.

@jreback jreback closed this Aug 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants