How to change size of point in px.strip plot

How can I change the point size in px.strip plot ?

Hi @yogi_dhiman, same approach as in the scatter plot :slight_smile:

fig.update_traces({'marker':{'size': your_desired_size}})

Full example:

import as px

df =
fig = px.strip(df, x='total_bill', y='day')
fig.update_traces({'marker':{'size': 50, 'color': 'pink'}})


what if want to give size based on some variable
will following work

fig.update_traces({β€˜marker’:{β€˜size’: df[β€˜size’], β€˜color’: df['color]}})

Hi, you can change the marker size and color for each trace:

Hi @yogi_dhiman,

I admit, I got a bit carried away by your question and came up with a scatter strip plot :joy:

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 as px
import plotly.graph_objects as go

# create data
df =

# 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
for tip, gender in zip(df.rel_tip,
    if tip>25:
    elif 20<tip<=25:

# set marker color, female=gold, male=crimson
color=[['crimson', 'gold'][gender == 'Female'] for gender in]

# create plotly.graph_objects Figure()  and add trace
figure = go.Figure()
    marker={'size': size, 'color': color}


AIMPED i am looking for the point size based on variable value in strip plot itself ( your assumption was correct )
Can we do it ?

Hey @yogi_dhiman, I did not figure out how to do it. Actually I do not think it’s possible. The marker + color argument does not accept iterables. You can see this by switching the chart type:

import as px
import numpy as np

# data
df =

# figure
px_fig = px.strip(df, x='total_bill', y='day')
#px_fig = px.scatter(df, x='total_bill', y='day')

# update marker size
marker_size = np.random.randint(1, 30, df.shape[0])
1 Like

This is a big limitation of the strip plot, in my opinion. As I have too many points to be displayed, I am clustering them, it would be great to have an indication of the size of each cluster. Colour is not an option in this case, as I have already coloured the markers by using a different property.