1

I want to plot a scatter plot for specific day .How to plot scatter with only two columns [Saturday and Sunday]?

px.scatter(
           df, x="total_bill", y="tip", 
           color="size", facet_col="day"
)


df.day.value_counts()

Sat     87
Sun     76
Thur    62
Fri     19
Name: day, dtype: int64

This is scatter plotted for all columns.

enter image description here

1 Answer 1

3

You just need to filter your df. It doesn't matter if you do so before or when you call px

import plotly.express as px
df = px.data.tips()

px.scatter(df[df["day"].isin(["Sat", "Sun"])],
           x="total_bill",
           y="tip", 
           color="size",
           facet_col="day"
)
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.