Skip to content

Commit

Permalink
Add symlog scales
Browse files Browse the repository at this point in the history
closes #702
  • Loading branch information
has2k1 committed Aug 4, 2023
1 parent 5bc4ff6 commit 94d697f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ Position scales
scale_x_log10
scale_x_reverse
scale_x_sqrt
scale_x_symlog
scale_x_timedelta
scale_y_continuous
scale_y_date
Expand All @@ -363,6 +364,7 @@ Position scales
scale_y_log10
scale_y_reverse
scale_y_sqrt
scale_y_symlog
scale_y_timedelta


Expand Down
5 changes: 5 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ API Changes

New
***

- Added symmetric logarithm transformation scales
:class:`~plotnine.scales.scale_x_symlog` and
:class:`~plotnine.scales.scale_x_symlog`

- Gained themeables

- :meth:`~plotnine.themes.themeable.plot_margin_left`
Expand Down
2 changes: 2 additions & 0 deletions plotnine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
"scale_x_log10",
"scale_x_reverse",
"scale_x_sqrt",
"scale_x_symlog",
"scale_x_timedelta",
"scale_y_continuous",
"scale_y_date",
Expand All @@ -222,6 +223,7 @@
"scale_y_log10",
"scale_y_reverse",
"scale_y_sqrt",
"scale_y_symlog",
"scale_y_timedelta",
"xlim",
"ylim",
Expand Down
4 changes: 4 additions & 0 deletions plotnine/scales/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
scale_x_log10,
scale_x_reverse,
scale_x_sqrt,
scale_x_symlog,
scale_x_timedelta,
scale_y_continuous,
scale_y_date, # pyright: ignore
Expand All @@ -135,6 +136,7 @@
scale_y_log10,
scale_y_reverse,
scale_y_sqrt,
scale_y_symlog,
scale_y_timedelta,
)

Expand Down Expand Up @@ -236,6 +238,7 @@
"scale_x_log10",
"scale_x_reverse",
"scale_x_sqrt",
"scale_x_symlog",
"scale_x_timedelta",
"scale_y_continuous",
"scale_y_date",
Expand All @@ -244,6 +247,7 @@
"scale_y_log10",
"scale_y_reverse",
"scale_y_sqrt",
"scale_y_symlog",
"scale_y_timedelta",
# limits
"xlim",
Expand Down
26 changes: 26 additions & 0 deletions plotnine/scales/scale_xy.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,3 +426,29 @@ class scale_y_reverse(scale_y_continuous):
"""

_trans = "reverse"


@document
class scale_x_symlog(scale_x_continuous):
"""
Continuous x position symmetric logarithm transformed scale
Parameters
----------
{superclass_parameters}
"""

_trans = "symlog"


@document
class scale_y_symlog(scale_y_continuous):
"""
Continuous y position symmetric logarithm transformed scale
Parameters
----------
{superclass_parameters}
"""

_trans = "symlog"

0 comments on commit 94d697f

Please sign in to comment.