@@ -324,14 +324,19 @@ def _filled_count_geom_map(
324
324
from python_ggplot .gg .styles .utils import apply_style
325
325
326
326
grouped = df .groupby (filled_stat_geom .map_discrete_columns , sort = False ) # type: ignore
327
+ sorted_keys = sorted (grouped .groups .keys (), reverse = True ) # type: ignore
327
328
col = pd .Series (dtype = float ) # For stacking
328
329
329
330
all_classes = pd .Series (df [filled_stat_geom .get_x_col ()].unique ()) # type: ignore
330
331
if len (filled_stat_geom .continuous_scales ) > 0 :
331
332
raise GGException ("continuous_scales > 0" )
332
333
333
- for keys , sub_df in grouped : # type: ignore
334
- apply_style (style , sub_df , filled_stat_geom .discrete_scales , [(keys [0 ], VString (i )) for i in grouped .groups ]) # type: ignore
334
+ for keys in sorted_keys : # type: ignore
335
+ sub_df = grouped .get_group (keys ) # type: ignore
336
+ key_values = list (product (filled_stat_geom .map_discrete_columns , [keys ])) # type: ignore
337
+ current_style = apply_style (
338
+ deepcopy (style ), sub_df , filled_stat_geom .discrete_scales , key_values
339
+ ) # type: ignore
335
340
336
341
weight_scale = filled_scales .get_weight_scale (
337
342
filled_stat_geom .geom , optional = True
@@ -356,7 +361,7 @@ def _filled_count_geom_map(
356
361
filled_geom .gg_data .yield_data [keys ] = apply_cont_scale_if_any ( # type: ignore
357
362
yield_df ,
358
363
filled_stat_geom .continuous_scales ,
359
- style ,
364
+ current_style ,
360
365
filled_stat_geom .geom .geom_type ,
361
366
to_clone = True ,
362
367
)
@@ -527,6 +532,7 @@ def _filled_smooth_geom_map(
527
532
style : "GGStyle" ,
528
533
) -> "FilledGeom" :
529
534
from python_ggplot .gg .styles .utils import apply_style
535
+
530
536
grouped = df .groupby (filled_stat_geom .map_discrete_columns , sort = True ) # type: ignore
531
537
sorted_keys = sorted (grouped .groups .keys (), reverse = True ) # type: ignore
532
538
col = pd .Series (dtype = float ) # type: ignore
@@ -536,7 +542,7 @@ def _filled_smooth_geom_map(
536
542
key_values = list (product (filled_stat_geom .map_discrete_columns , [keys ])) # type: ignore
537
543
current_style = apply_style (
538
544
deepcopy (style ), sub_df , filled_stat_geom .discrete_scales , key_values
539
- ) # type: ignore
545
+ ) # type: ignore
540
546
541
547
yield_df = sub_df .copy () # type: ignore
542
548
0 commit comments