I'm trying to plot a boxplot of a pandas dataframe in python, but I can not get a frame around my plot.
This is the code I am using to plot
fig, ax = plt.subplots()
ax.set_facecolor('white')
df.boxplot(whis=False, patch_artist=True, ax=ax)
ax.set_frame_on(True)
ax.grid(color='grey', linestyle='-', linewidth=0.6)
ax.set_xticklabels((burstsizes))
plt.yticks(np.arange(0,6.6,0.2))
plt.show()
This produces following plot: enter image description here
I want to have a frame around the plot but I can not figure out how. I have tried to set a frame with
ax.spines['bottom'].setcolor('0.5') # for top left and right too
with
plt.rcParams["axes.edgecolor"] = "0.15"
plt.rcParams["axes.linewidth"] = 1.25
and with
plt.rcParams["axes.grid"] = True
all of these solution did not change the plot at all. I believe it might have to do with the way pandas uses matplotlib but I am not sure. Any help would be very much appreciated. I am using Python 3.5.3.