Skip to content
This repository was archived by the owner on Mar 22, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 16 additions & 0 deletions ggplot/geoms/geom_ribbon.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .geom import geom
from ..utils import is_date
import numpy as np
from ..ggplot import ggplot

class geom_ribbon(geom):
"""
Expand Down Expand Up @@ -35,6 +36,21 @@ class geom_ribbon(geom):
DEFAULT_PARAMS = {}

_aes_renames = {'linetype': 'linestyle', 'size': 'linewidth', 'fill': 'facecolor', 'color': 'edgecolor'}


def __radd__(self, gg):
if isinstance(gg, ggplot):
gg.layers += self.layers
if self.geom_aes is not None:
for aes_key in ['fill', ]:
if aes_key in self.geom_aes:
gg._aes[aes_key] = self.geom_aes.pop(aes_key)
return gg

self.layers.append(gg)
return self


def plot(self, ax, data, _aes):
(data, _aes) = self._update_data(data, _aes)
params = self._get_plot_args(data, _aes)
Expand Down
6 changes: 3 additions & 3 deletions ggplot/ggplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ def __init__(self, aesthetics, data):
self._aes = aesthetics
self.data = data.copy()
self._handle_index()
self.data = self._aes._evaluate_expressions(self.data)
self.data = self._aes.handle_identity_values(self.data)


self.layers = []

Expand Down Expand Up @@ -353,6 +350,9 @@ def _get_mapping(self, aes_type, colname):

def _construct_plot_data(self):
"Splits up the main data based on discrete aesthetics into sub-data frames"
#parsing aes relocated here from __init__ to allow for aes expressions to be supplied in subsequent geom_*()
self.data = self._aes._evaluate_expressions(self.data)
self.data = self._aes.handle_identity_values(self.data)
data = self.data
discrete_aes = self._aes._get_discrete_aes(data)
mappers = {}
Expand Down