I'm working on a strip plot using Plotly.express to show the number of sequences per COVID variant along the time in different countries. I would like to implement the following rule and I didn't get how to do it:
When I have overlapping dots (different variants on the same date) they should be sorted by Count column. This means that the most prevalent variants will be more visible.
Here is my code with a sample of the data:
import pandas as pd
import plotly.express as px
df = pd.read_csv("https://raw.githubusercontent.com/joicy/bioinfo/main/country_lineages.csv")
fig = px.strip(df.sort_values("Count", ascending=False), x="date_2weeks", y="country",
color="variant",
custom_data=['country','variant', 'date_2weeks', 'Count'],
hover_data=["Count"]).update_traces(jitter = 1)
fig.update_traces(marker=dict(size=13, line=dict(width=0.5, color='#E5ECF6')))
fig
I tried sorting by Count but is not working, as you can see in the figure below:

The order I expect in this case is green (19), pink (9), and then white (1) and dark green (1).
PS.: The screenshot is from the original data just to show more points.