@@ -308,6 +308,8 @@ def plot(self,
308
308
ax , coordinates_dict = self ._list_labels (ax , self .height , self .width , self .label )
309
309
310
310
space = self .space * 10 if label else 0
311
+ # when space set to 1, change to univariate mode
312
+ space_univar = True if space == 10 else False
311
313
bar = self .bar_width * 3.5 / max (data_point_numbers )
312
314
313
315
if self .shape == "parallelogram" :
@@ -372,35 +374,37 @@ def plot(self,
372
374
label_rectangle_widths .append (label_rectangle_width )
373
375
374
376
if not hi_var :
375
- ax = figure_type .plot (ax , left_center_pts , right_center_pts , widths , default_color )
377
+ if not space_univar :
378
+ ax = figure_type .plot (ax , left_center_pts , right_center_pts , widths , default_color )
376
379
if label_rectangle :
377
380
ax = label_rectangle_painter .plot (ax , label_rectangle_left_center_pts , label_rectangle_right_center_pts , label_rectangle_widths ,label_rectangle_default_color )
378
381
else :
379
382
width_color_total = [0 ] * len (widths )
380
383
label_rectangle_width_color_total = [0 ] * len (coordinates_dict )
381
384
xs , ys = figure_type .get_coordinates (left_center_pts , right_center_pts , widths )
382
- for color in self .color_lst :
383
- widths_color , ratio_color_centers = [], []
384
- index = 0
385
- for col in pair_dict_lst_color :
386
- for k , v in col .items ():
387
- left_label = k [0 ]
388
- right_label = k [1 ]
389
- if v .get (color ):
390
- width_temp = bar * v .get (color )
391
- if self .min_bar_width and width_temp <= self .min_bar_width :
392
- width_temp = self .min_bar_width
393
- else :
394
- width_temp = 0
395
-
396
- widths_color .append (width_temp )
397
- ratio_color_centers .append ((width_color_total [index ] + width_temp / 2 ) / widths [index ])
398
- width_color_total [index ] += width_temp
399
- index += 1
400
-
401
- color_left_center_pts , color_right_center_pts = figure_type .get_center_highlight (xs , ys ,
402
- ratio_color_centers )
403
- ax = figure_type .plot (ax , color_left_center_pts , color_right_center_pts , widths_color , color )
385
+ if not space_univar :
386
+ for color in self .color_lst :
387
+ widths_color , ratio_color_centers = [], []
388
+ index = 0
389
+ for col in pair_dict_lst_color :
390
+ for k , v in col .items ():
391
+ left_label = k [0 ]
392
+ right_label = k [1 ]
393
+ if v .get (color ):
394
+ width_temp = bar * v .get (color )
395
+ if self .min_bar_width and width_temp <= self .min_bar_width :
396
+ width_temp = self .min_bar_width
397
+ else :
398
+ width_temp = 0
399
+
400
+ widths_color .append (width_temp )
401
+ ratio_color_centers .append ((width_color_total [index ] + width_temp / 2 ) / widths [index ])
402
+ width_color_total [index ] += width_temp
403
+ index += 1
404
+
405
+ color_left_center_pts , color_right_center_pts = figure_type .get_center_highlight (xs , ys ,
406
+ ratio_color_centers )
407
+ ax = figure_type .plot (ax , color_left_center_pts , color_right_center_pts , widths_color , color )
404
408
405
409
# always remember that color list was reversed, so the first color is the default color
406
410
if label_rectangle :
0 commit comments