Skip to content

Commit 6c6a2df

Browse files
committed
Fix Issue #51 automatic labels for y axes
1 parent 4673a18 commit 6c6a2df

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

dabest/plotter.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -670,16 +670,13 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
670670

671671

672672

673-
674-
# Place raw axes y-label.
675-
if plot_kwargs['swarm_label'] is not None:
676-
swarm_label = plot_kwargs['swarm_label']
677-
else:
673+
# Set raw axes y-label.
674+
swarm_label = plot_kwargs['swarm_label']
675+
if swarm_label is None and yvar is None:
676+
swarm_label = "value"
677+
elif swarm_label is None and yvar is not None:
678678
swarm_label = yvar
679-
rawdata_axes.set_ylabel(swarm_label)
680-
681-
682-
679+
683680
# Place contrast axes y-label.
684681
contrast_label_dict = {'mean_diff' : "mean difference",
685682
'median_diff' : "median difference",
@@ -702,8 +699,8 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
702699
contrast_axes.yaxis.set_label_position("right")
703700

704701

705-
# Set the rawdata axes labels appropriately
706-
rawdata_axes.set_ylabel(plot_kwargs["swarm_label"])
702+
# Set the rawdata axes labels appropriately
703+
rawdata_axes.set_ylabel(swarm_label)
707704
rawdata_axes.set_xlabel("")
708705

709706

0 commit comments

Comments
 (0)