I am looking to overlay a scatter plot with a boxplot in matplotlib. I have created the chart but the x axes do not match--leading to the scatter plot showing dots that are shifted 1 tick to the left of the x axis for the boxplot. Below is my code.
fig, ax = plt.subplots()
ax.scatter(traits_5, data_df[traits_5].loc[y])
ax = greats_df[traits_5].boxplot ( showfliers=False , column=traits_5)
plt.ylabel ( 'Percentile Score' )
plt.title ( "Distribution of The Greats' Scores" )
ax.yaxis.set_major_formatter(mtick.PercentFormatter(1))
plt.show ()
Is it possible that the error is coming from the two different methods of plotting the data? I use matplotlib to plot the scatter and pandas to plot the boxplot. Matplotlib was plotting the rows on the xaxis, whereas I wanted the columns to be plotted along the x axis.
See outputted image below from above code.