python - Different box plots on the same oX position -


i trying combine box plots scatter plot algorithm scoring visualization. data divided following:

  • ox - information time period (1 year, 2 years, etc.)
  • oy - information score
  • 2 algorithms each period different simulation results (plotted boxplots)
  • 2 heuristics single value (plotted point)

i'm trying compare method efficiency each period of time.

small sample data:

1 year              2 years          a1  a2  h1  h2  a1  a2  h1  h2 124 168 155 167 130 130 150 164 102 155         100 172      103 153         117 145      102 132         145 143      145 170         133 179      136 125         115 153      116 150         136 131      146 192         106 148      124 122         127 158      128 123         149 200      141 158         137 156      

i'm trying looks this: enter image description here

so far i've cleared data have observations each algorithm (rs, ea) , each period (52, 104, 156 etc.) separately like so can't figure out how group them per period while drawing 2 different boxplots same x tick. assume once i'd sort out boxplot dataframe , plot, can plot scatter on top.

managed solve meanwhile, in case helps else out:

ax1 = sns.boxplot(data = meta, x = 'time', y = 'prs', color = '#880bdd', linewidth=0.8) ax1 = sns.boxplot(data = meta, x = 'time', y = 'ea', color = '#0bc9dd', linewidth=0.8) ax1 = sns.boxplot(data = meta, x = 'time', y = 'ers', color = '#9bd19d', linewidth=0.8) ax1 = sns.pointplot(data = simple, x = 'time', y = 'greedy average', color='#ffc48c', markers ='s', join=false) ax1 = sns.pointplot(data = simple, x = 'time', y = 'greedy total', color='#ff9f80', markers='o', join=false) ax1 = sns.pointplot(data = simple, x = 'time', y = 'greedy weeks', color='#f56991', markers='*', join=false) ax1.set(xlabel = "planning horizon (weeks)") ax1.set(ylabel = "hypervolume") ea = mpatches.patch(color='#0bc9dd', label = 'ea') prs = mpatches.patch(color='#880bdd', label = 'prs') ers = mpatches.patch(color='#9bd19d', label = 'ers') ga = mlines.line2d([], [], color='#ffc48c', marker = 's', label = 'greedy average') gt = mlines.line2d([], [],color='#ff9f80', label = 'greedy total', marker = 'o') gw = mlines.line2d([], [],color='#f56991', label = 'greedy weeks', marker = '*') plt.legend(handles = [ea, ers, prs, ga, gt, gw], loc = 'bottom left', title = "algorithm") ax1.set_title("algorithm comparison") 

results in this:

enter image description here


Comments