Hi @yogi_dhiman,
I admit, I got a bit carried away by your question and came up with a scatter strip plot
What gets lost in this process, is the separation of the data points for a given y-coordinate (in this case the weekday) which is created by px.strip
import plotly.express as px
import plotly.graph_objects as go
# create data
df = px.data.tips()
# calculate relative tip
df['rel_tip'] = df.tip / df.total_bill *100
df.rel_tip = df.rel_tip.apply(round,0)
# set the marker size
# all relative tips above 25% --> 30
# all relative tips above 20% to 25% --> 20
# rest --> 10
size=[]
for tip, gender in zip(df.rel_tip, df.sex):
if tip>25:
size.append(30)
elif 20<tip<=25:
size.append(20)
else:
size.append(10)
# set marker color, female=gold, male=crimson
color=[['crimson', 'gold'][gender == 'Female'] for gender in df.sex]
# create plotly.graph_objects Figure() and add trace
figure = go.Figure()
figure.add_scatter(
x=df.total_bill,
y=df.day,
mode='markers',
marker={'size': size, 'color': color}
)
figure.update_layout(template='plotly_dark')
figure.show()
creates: