I am trying to change the appearance of boxes in a Seaborn boxplot. I would like all the boxes to be transparent and the borders of the boxes to be listed. Here is the code I'm working with:
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
df = pd.DataFrame(np.random.rand(10,4),columns=list('ABCD'))
df['E'] = [1,2,3,1,1,4,3,2,3,1]
sns.boxplot(x=df['E'],y=df['C'])
box = ax.get_position()
ax.set_position([box.x0, box.y0 + box.height * 0.1, box.width, box.height * 0.9])
handles, labels = ax.get_legend_handles_labels()
leg = plt.legend(handles[0:2], labels[0:2],
loc='upper center', bbox_to_anchor=(0.5, 1.10), ncol=2)
plt.show()
This post shows how to change the color and rectangle by one square. However, I would like to assign box edgecolors based on a list like this box_line_col = ['r','g',b','purple']. The above code creates 4 fields on the chart - I would like to assign field colors for each field, starting from the first (extreme) field and continuing to the last (rightmost) field.
Is it possible to specify the colors of the edge of the box from the list while maintaining the transparent margins (facecolor = white)?