Skip to content

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

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
7e461a1
remove \n from docstring
charlesdong1991 Dec 3, 2018
1314059
fix conflicts
charlesdong1991 Jan 19, 2019
db4440d
add sym option for logx logy loglog and tests
charlesdong1991 Jan 21, 2019
a49be7f
BUG: DataFrame respects dtype with masked recarray (#24874)
mroeschke Jan 22, 2019
853cd70
REF/CLN: Move private method (#24875)
mroeschke Jan 22, 2019
6155ffd
changes based on reviews
charlesdong1991 Jan 22, 2019
597f9f3
BUG : ValueError in case on NaN value in groupby columns (#24850)
cgangwar11 Jan 22, 2019
c588437
BUG: fix floating precision formatting in presence of inf (#24863)
glemaitre Jan 23, 2019
8972ddf
DOC: Creating top-level user guide section, and moving pages inside (…
datapythonista Jan 23, 2019
14eac28
DOC: Creating top-level development section, and moving pages inside …
datapythonista Jan 23, 2019
4b937ff
DOC: Creating top-level getting started section, and moving pages ins…
datapythonista Jan 23, 2019
6a745d8
DOC: Implementing redirect system, and adding user_guide redirects (#…
datapythonista Jan 23, 2019
2fa0835
DOC: fixups (#24888)
TomAugspurger Jan 23, 2019
94d989e
CLN: fix typo in ctors.SeriesDtypesConstructors setup (#24894)
qwhelan Jan 24, 2019
0c319f5
DOC: No clean in sphinx_build (#24902)
TomAugspurger Jan 24, 2019
17ad791
BUG (output formatting): use fixed with for truncation column instead…
jorisvandenbossche Jan 24, 2019
e2c0b12
DOC: also redirect old whatsnew url (#24906)
jorisvandenbossche Jan 24, 2019
0a4665a
Revert BUG-24212 fix usage of Index.take in pd.merge (#24904)
TomAugspurger Jan 24, 2019
fa12b9e
DOC: Add experimental note to DatetimeArray and TimedeltaArray (#24882)
TomAugspurger Jan 24, 2019
5761e35
Disable M8 in nanops (#24907)
TomAugspurger Jan 24, 2019
539c54f
CLN: fix typo in asv benchmark of non_unique_sorted, which was not so…
qwhelan Jan 25, 2019
f971b11
API/VIS: remove misc plotting methods from plot accessor (revert #238…
jorisvandenbossche Jan 25, 2019
bb86a9d
DOC: some 0.24.0 whatsnew clean-up (#24911)
jorisvandenbossche Jan 25, 2019
013ae3d
DOC: Final reorganization of documentation pages (#24890)
datapythonista Jan 25, 2019
85982ed
DOC: Adding redirects to API moved pages (#24909)
datapythonista Jan 25, 2019
0bc2d3e
DOC: Making home page links more compact and clearer (#24928)
datapythonista Jan 25, 2019
14b68ea
DOC: 0.24 release date (#24930)
TomAugspurger Jan 25, 2019
8a8a083
DOC: Adding version to the whatsnew section in the home page (#24929)
datapythonista Jan 25, 2019
c8aae35
API: Remove IntervalArray from top-level (#24926)
TomAugspurger Jan 25, 2019
83eb242
RLS: 0.24.0
TomAugspurger Jan 25, 2019
0c4113f
DEV: Start 0.25 cycle
TomAugspurger Jan 25, 2019
d2fa4b4
DOC: State that we support scalars in to_numeric (#24944)
gfyoung Jan 26, 2019
2626215
DOC: Minor what's new fix (#24933)
rth Jan 26, 2019
c1cad5d
TST: GH#23922 Add missing match params to pytest.raises (#24937)
mike-cramblett Jan 26, 2019
dd7afa0
Add tests for NaT when performing dt.to_period (#24921)
alexander-ponomaroff Jan 26, 2019
b641963
DOC: switch headline whatsnew to 0.25 (#24941)
h-vetinari Jan 26, 2019
41166c6
BUG-24212 fix regression in #24897 (#24916)
JustinZhengBC Jan 26, 2019
69a2c54
CLN: reduce overhead in setup for categoricals benchmarks in asv (#24…
qwhelan Jan 26, 2019
9541540
Excel Reader Refactor - Base Class Introduction (#24829)
WillAyd Jan 26, 2019
37a224d
TST/REF: Add pytest idiom to test_numeric.py (#24946)
gfyoung Jan 26, 2019
602eda4
BLD: silence npy_no_deprecated warnings with numpy>=1.16.0 (#24864)
jbrockmendel Jan 26, 2019
95f8dca
CLN: Refactor cython to use memory views (#24932)
noamher Jan 26, 2019
2b16e2e
DOC: Clean sort_values and sort_index docstrings (#24843)
Jan 27, 2019
22b2795
changes based on reviews
charlesdong1991 Jan 27, 2019
f724113
add sym option for logx logy loglog and tests
charlesdong1991 Jan 21, 2019
aab92ae
changes based on reviews
charlesdong1991 Jan 22, 2019
c04601a
changes based on reviews
charlesdong1991 Jan 27, 2019
41b08c8
add whatsnew
charlesdong1991 Jan 27, 2019
7bc480a
Merge branch 'issue_24867' of github.com:charlesdong1991/pandas into …
charlesdong1991 Jan 27, 2019
0bd227f
all my changes in a signle change
charlesdong1991 Jan 27, 2019
36c8eb4
Merge branch 'issue_24867' of github.com:charlesdong1991/pandas into …
charlesdong1991 Jan 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions pandas/plotting/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def _kind(self):
_default_rot = 0
orientation = None
_pop_attributes = ['label', 'style', 'logy', 'logx', 'loglog',
'mark_right', 'stacked']
'mark_right', 'stacked', 'sym']
_attr_defaults = {'logy': False, 'logx': False, 'loglog': False,
'mark_right': True, 'stacked': False}
'mark_right': True, 'stacked': False, 'sym': False}

def __init__(self, data, kind=None, by=None, subplots=False, sharex=None,
sharey=False, use_index=True,
Expand Down Expand Up @@ -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]
Copy link
Contributor

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]

if self.sym:
[a.set_xscale('symlog') for a in axes]
else:
[a.set_xscale('log') for a in axes]
if self.logy or self.loglog:
[a.set_yscale('log') for a in axes]
if self.sym:
[a.set_yscale('symlog') for a in axes]
else:
[a.set_yscale('log') for a in axes]

self.fig = fig
self.axes = axes
Expand Down
6 changes: 6 additions & 0 deletions pandas/tests/plotting/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,18 @@ def test_logscales(self):
df = DataFrame({'a': np.arange(100)}, index=np.arange(100))
ax = df.plot(logy=True)
self._check_ax_scales(ax, yaxis='log')
ax = df.plot(logy=True, sym=True)
self._check_ax_scales(ax, yaxis='symlog')

ax = df.plot(logx=True)
self._check_ax_scales(ax, xaxis='log')
ax = df.plot(logx=True, sym=True)
self._check_ax_scales(ax, xaxis='symlog')

ax = df.plot(loglog=True)
self._check_ax_scales(ax, xaxis='log', yaxis='log')
ax = df.plot(loglog=True, sym=True)
self._check_ax_scales(ax, xaxis='symlog', yaxis='symlog')

@pytest.mark.slow
def test_xcompat(self):
Expand Down