I encounter some weird behavior in matplotlib boxplot when I use the " notch " form. I am using some code that I wrote some time ago and I never had these problems. I wonder what the problem is. Any ideas?

When I rotate the shape of the cutout, it looks fine, although

This will be the code:
def boxplot_modified(data): fig = plt.figure(figsize=(8,6)) ax = plt.subplot(111) bplot = plt.boxplot(data, #notch=True, # notch shape vert=True, # vertical box aligmnent sym='ko', # red circle for outliers patch_artist=True, # fill with color ) # choosing custom colors to fill the boxes colors = 3*['lightgreen'] + 3*['lightblue'], 'lightblue', 'lightblue', 'lightblue'] for patch, color in zip(bplot['boxes'], colors): patch.set_facecolor(color) # modifying the whiskers: straight lines, black, wider for whisker in bplot['whiskers']: whisker.set(color='black', linewidth=1.2, linestyle='-') # making the caps a little bit wider for cap in bplot['caps']: cap.set(linewidth=1.2) # hiding axis ticks plt.tick_params(axis="both", which="both", bottom="off", top="off", labelbottom="on", left="off", right="off", labelleft="on") # adding horizontal grid lines ax.yaxis.grid(True) # remove axis spines ax.spines["top"].set_visible(False) ax.spines["right"].set_visible(False) ax.spines["bottom"].set_visible(True) ax.spines["left"].set_visible(True) plt.xticks([y+1 for y in range(len(data))], 8*['x']) # raised title #plt.text(2, 1, 'Modified', # horizontalalignment='center', # fontsize=18) plt.tight_layout() plt.show() boxplot_modified(df.values)
and when I make a simple graph without tuning, the problem still arises:
def boxplot(data): fig = plt.figure(figsize=(8,6)) ax = plt.subplot(111) bplot = plt.boxplot(data, notch=True,
