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

ENH: Expose symlog scaling in plotting API #24968

Merged
merged 14 commits into from
Apr 12, 2019

Conversation

charlesdong1991
Copy link
Member

@charlesdong1991 charlesdong1991 commented Jan 27, 2019

@charlesdong1991
Copy link
Member Author

I am very very sorry that i made some git mistakes in my preivous PR, so i closed it and reopen this one.
And this one is based on the review from @jreback. #24871
Will appreciate a lot for further feedbacks.

@codecov
Copy link

codecov bot commented Jan 27, 2019

Codecov Report

Merging #24968 into master will decrease coverage by 49.49%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24968      +/-   ##
==========================================
- Coverage   92.38%   42.88%   -49.5%     
==========================================
  Files         166      166              
  Lines       52398    52406       +8     
==========================================
- Hits        48406    22476   -25930     
- Misses       3992    29930   +25938
Flag Coverage Δ
#multiple ?
#single 42.88% <0%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/plotting/_core.py 17.68% <0%> (-65.9%) ⬇️
pandas/io/formats/latex.py 0% <0%> (-100%) ⬇️
pandas/core/categorical.py 0% <0%> (-100%) ⬇️
pandas/io/sas/sas_constants.py 0% <0%> (-100%) ⬇️
pandas/tseries/plotting.py 0% <0%> (-100%) ⬇️
pandas/tseries/converter.py 0% <0%> (-100%) ⬇️
pandas/io/formats/html.py 0% <0%> (-99.35%) ⬇️
pandas/core/groupby/categorical.py 0% <0%> (-95.46%) ⬇️
pandas/io/sas/sas7bdat.py 0% <0%> (-91.17%) ⬇️
pandas/io/sas/sas_xport.py 0% <0%> (-90.15%) ⬇️
... and 124 more

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 2b16e2e...f1c86af. Read the comment docs.

@codecov
Copy link

codecov bot commented Jan 27, 2019

Codecov Report

Merging #24968 into master will increase coverage by 0.01%.
The diff coverage is 75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24968      +/-   ##
==========================================
+ Coverage   91.45%   91.47%   +0.01%     
==========================================
  Files         172      173       +1     
  Lines       52892    52883       -9     
==========================================
+ Hits        48373    48375       +2     
+ Misses       4519     4508      -11
Flag Coverage Δ
#multiple 90.03% <75%> (+0.01%) ⬆️
#single 41.8% <0%> (-0.02%) ⬇️
Impacted Files Coverage Δ
pandas/plotting/_core.py 83.57% <75%> (-0.09%) ⬇️
pandas/io/packers.py 88.11% <0%> (-0.11%) ⬇️
pandas/core/panel.py 35.62% <0%> (-0.1%) ⬇️
pandas/io/formats/printing.py 85.34% <0%> (-0.08%) ⬇️
pandas/io/pytables.py 90.19% <0%> (-0.01%) ⬇️
pandas/io/formats/format.py 97.99% <0%> (ø) ⬆️
pandas/io/formats/latex.py 100% <0%> (ø) ⬆️
pandas/core/indexes/interval.py 95.25% <0%> (ø) ⬆️
pandas/core/indexes/multi.py 95.62% <0%> (ø) ⬆️
pandas/core/api.py 100% <0%> (ø) ⬆️
... and 20 more

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 6e0f9a9...5170000. Read the comment docs.

-
-
-
:func:`DataFrame.plot` allows to expose symlog scaling for axis.
Copy link
Contributor

Choose a reason for hiding this comment

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

can you make this more informative, something like
DataFrame.plot keyword logy and logx now accept the value sym to .....

Copy link
Contributor

Choose a reason for hiding this comment

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

add the issue number (or if not issue, this PR number)

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks for the review, changed! @jreback

@@ -308,10 +308,21 @@ def _setup_subplots(self):

axes = _flatten(axes)

if self.logx or self.loglog:
valid_log = [False, True, 'sym', None]
Copy link
Contributor

Choose a reason for hiding this comment

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

use a set comprehension to check

pandas/plotting/_core.py Outdated Show resolved Hide resolved
@charlesdong1991
Copy link
Member Author

can anyone give a feedback? ^^

@TomAugspurger TomAugspurger added this to the 0.25.0 milestone Mar 5, 2019
Copy link
Contributor

@TomAugspurger TomAugspurger left a comment

Choose a reason for hiding this comment

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

Couple minor comments. LGTM otherwise.

@@ -19,6 +19,8 @@ including other versions of pandas.
Other Enhancements
^^^^^^^^^^^^^^^^^^


- :func:`DataFrame.plot` keywords ``logy``, ``logx`` and ``loglog`` can now accept the value ``sym`` for symlog scaling. (:issue:`24867`)
Copy link
Contributor

Choose a reason for hiding this comment

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

Put sym in quotes, like ``'sim'``

Copy link
Member Author

Choose a reason for hiding this comment

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

added!

valid_log = {False, True, 'sym', None}
input_log = {self.logx, self.logy, self.loglog}
if input_log - valid_log:
raise ValueError("Valid inputs are boolean, None and 'sym'.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Capture the bad parameter values and include them in the error message.

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks, changed! @TomAugspurger

valid_log = {False, True, 'sym', None}
input_log = {self.logx, self.logy, self.loglog}
if input_log - valid_log:
raise ValueError(f"Valid inputs are boolean, None and 'sym'"
Copy link
Contributor

Choose a reason for hiding this comment

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

We can't use f-strings yet, unfortunately.

Copy link
Member Author

Choose a reason for hiding this comment

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

sorry, changed! thanks! @TomAugspurger

Copy link
Contributor

Choose a reason for hiding this comment

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

May need to push these changes.

Copy link
Member Author

Choose a reason for hiding this comment

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

ahh, i am really really sorry... i thought i successfully pushed the change before rushing home @TomAugspurger

# GH: 24867
df = DataFrame({'a': np.arange(100)}, index=np.arange(100))

msg = "Valid inputs are boolean, None and 'sym'"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you update the match msg to ensure that the bad parameter is included. You can remove the "wrong_input" fixture I think, and just test one bad input.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated!

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

Can you address merge conflict?

ax = df.plot(logy=True)
self._check_ax_scales(ax, yaxis='log')
assert ax.get_yscale() == 'log'
Copy link
Member

Choose a reason for hiding this comment

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

Rather than these individual checks can you parametrize all of the combinations?

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks! @WillAyd i parametrize the combinations.

pandas/tests/plotting/test_frame.py Show resolved Hide resolved
pandas/tests/plotting/test_frame.py Show resolved Hide resolved
@charlesdong1991
Copy link
Member Author

@TomAugspurger Hi, Tom, I checked your comment in #25586 and made some small changes and modified the tests to align it, feel free to provide your feedback.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

small doc comments

logx : bool or 'sym', default False
Use log scaling or symlog scaling on x axis
.. versionadded:: 0.25.0
logy : bool or 'sym' default False
Copy link
Contributor

Choose a reason for hiding this comment

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

need a blank line after the versionadded (for each of these); make these versionchanged

pandas/tests/plotting/test_frame.py Show resolved Hide resolved
@jreback
Copy link
Contributor

jreback commented Mar 30, 2019

@TomAugspurger a quick look if you can.

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

lgtm as well

@jreback jreback merged commit 03a0948 into pandas-dev:master Apr 12, 2019
@jreback
Copy link
Contributor

jreback commented Apr 12, 2019

thanks @charlesdong1991

yhaque1213 pushed a commit to yhaque1213/pandas that referenced this pull request Apr 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: Expose symlog scaling in plotting API
5 participants