How to scatter plot without sort in Matplotlib?

Viewed 21

I have this plotwhic is automatically sorted

I want this plot to be inverted i.e the categories with the highest avg buyer365 should appear at the top. Does anyone know how to deal with this? I really appreciate any help you can provide.

P.S code I used:

fig,axs=plt.subplots()
axs.scatter(trace1_summary["mean"],trace1_summary["cat3_items"])
axs.set(xlim=(-3,15),title= "89% Hdi Interval",ylabel="categories", xlabel="avg buyer365(standarized)")
axs.axvline(0.0,ls="--",color="k",alpha=0.5,label="average Buyer")
plt.legend()
1 Answers

You can plot the sorted in ascending order values:

axs.scatter("mean", "cat3_items", data=trace1_summary.sort_values("mean"))
Related