1

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
  • axs.scatter(trace1_summary["mean"][::-1],trace1_summary["cat3_items"][::-1]) should give what you expected. Commented Aug 11, 2022 at 12:31

1 Answer 1

1

You can plot the sorted in ascending order values:

axs.scatter("mean", "cat3_items", data=trace1_summary.sort_values("mean"))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.