Skip to content

Commit

Permalink
Accept title & subtitle kwargs for ggtitle
Browse files Browse the repository at this point in the history
closes #804
  • Loading branch information
has2k1 committed Jun 17, 2024
1 parent a3d893f commit f91d1e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
3 changes: 3 additions & 0 deletions doc/changelog.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ title: Changelog
- plotnine now responds to the `fig-width`, `fig-height` and `fig-format`
settings in the meta section of a quarto document.

- [](:class:`~plotnine.ggtitle`) now accepts `title` and `subtitle` as
keyword arguments. ({{<issue 804 >}})

### New Features

- [](:class:`~plotnine.geom_text`) has gained new aesthetics
Expand Down
15 changes: 6 additions & 9 deletions plotnine/labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ class xlab(labs):
x aesthetic label (x-axis)
"""

def __init__(self, name: str, /):
self.x = name
self.labels = labels_view(x=name)
def __init__(self, label: str):
super().__init__(x=label)


class ylab(labs):
Expand All @@ -131,9 +130,8 @@ class ylab(labs):
y aesthetic label i.e. y-axis label
"""

def __init__(self, name: str, /):
self.y = name
self.labels = labels_view(y=name)
def __init__(self, label: str):
super().__init__(y=label)


class ggtitle(labs):
Expand All @@ -146,6 +144,5 @@ class ggtitle(labs):
Plot title
"""

def __init__(self, title: str, /):
self.title = title
self.labels = labels_view(title=title)
def __init__(self, title: str | None = None, subtitle: str | None = None):
super().__init__(title=title, subtitle=subtitle)

0 comments on commit f91d1e7

Please sign in to comment.