-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Expose symlog scaling in plotting API #24871
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
Conversation
Not terribly familiar with this code but looks OK to me at a glance. cc @TomAugspurger - too late to get this in for v0.24 at this point right? |
Codecov Report
@@ Coverage Diff @@
## master #24871 +/- ##
==========================================
- Coverage 92.38% 92.38% -0.01%
==========================================
Files 166 166
Lines 52412 52416 +4
==========================================
+ Hits 48423 48425 +2
- Misses 3989 3991 +2
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #24871 +/- ##
===========================================
- Coverage 92.38% 42.88% -49.51%
===========================================
Files 166 166
Lines 52412 52406 -6
===========================================
- Hits 48423 22476 -25947
- Misses 3989 29930 +25941
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear to be that this is working correctly. You should add a test that includes an assertion that ax.get_yscale() == 'symlog'
.
What's the user-facing API? I was thinking something like
df.plot(logy="sym")
so that a user can get regular log with log=True
, symlog with log="symlog"
or "sym", not sure which. And maybe accept "logit" too.
pandas/plotting/_core.py
Outdated
@@ -310,9 +310,15 @@ def _setup_subplots(self): | |||
axes = _flatten(axes) | |||
|
|||
if self.logx or self.loglog: | |||
[a.set_xscale('log') for a in axes] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably slightly cleaner to set
scale = 'symlog if self.sym else 'log'
[a.set_xscale(scale) for a in axes]
I like @TomAugspurger's proposed UI - it's exactly what I had in mind. Since the documented API is already |
Thank you very much @mdekstrand , it's good to know! since my proposal will be quite significant API change, so i would like to hear all of yours opinions first before submitting the pr... i will then keep Tom's proposal first in it! |
…andas-dev#24715) * DOC: Implementing redirect system, and adding user_guide redirects * Using relative urls for the redirect * Validating that no file is overwritten by a redirect * Adding redirects for getting started and development sections
* Fixed heading on whatnew * Remove empty scalars.rst
… of inferring from last column (pandas-dev#24905)
* Revert BUG-24212 fix usage of Index.take in pd.merge xref pandas-dev#24733 xref pandas-dev#24897 * test 0.23.4 output * added note about buggy test
…s-dev#24882) * DOC: Add experimental note to DatetimeArray and TimedeltaArray
* Disable M8 in nanops Closes pandas-dev#24752
We support it and test it already. xref pandas-devgh-24910.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls add a whatsnew note in 0.25.0 other enhancements
pandas/plotting/_core.py
Outdated
valid_log = [False, True, 'sym'] | ||
for i in [self.logx, self.logy, self.loglog]: | ||
if i not in valid_log: | ||
raise ValueError("Wrong input for log option.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
show the option that was passed
pandas/plotting/_core.py
Outdated
@@ -309,10 +309,20 @@ def _setup_subplots(self): | |||
|
|||
axes = _flatten(axes) | |||
|
|||
if self.logx or self.loglog: | |||
valid_log = [False, True, 'sym'] | |||
for i in [self.logx, self.logy, self.loglog]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can do this with a set operation; is None also valid?
sorry, since i have several branches working on the same time... there are some git issues that i didn't notice so i messed it up... i will close this PR, and reopen another one... sorry... |
git diff upstream/master -u -- "*.py" | flake8 --diff