diff --git a/doc/changelog.rst b/doc/changelog.rst index c59dd1482..80d5ccbde 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -13,6 +13,9 @@ Bug Fixes - Fixed :class:`~plotnine.geoms.geom_map` to plot ``MultiLineString`` geom types. +- Fixed :class:`~plotnine.geoms.geom_text` to allow any order of ``mapping`` and + ``data`` positional arguments. + Enhancements ************ - Manual scales now match the values of the breaks if the breaks are given. diff --git a/plotnine/geoms/geom_text.py b/plotnine/geoms/geom_text.py index 008214753..47b68f5b3 100644 --- a/plotnine/geoms/geom_text.py +++ b/plotnine/geoms/geom_text.py @@ -9,7 +9,7 @@ else: HAS_ADJUST_TEXT = True -from ..utils import to_rgba +from ..utils import to_rgba, order_as_mapping_data from ..doctools import document from ..positions import position_nudge from ..exceptions import PlotnineError @@ -87,6 +87,7 @@ class geom_text(geom): 'path_effects': None} def __init__(self, mapping=None, data=None, **kwargs): + mapping, data = order_as_mapping_data(mapping, data) nudge_kwargs = {} adjust_text = kwargs.get('adjust_text', None) if adjust_text is None: