Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

Plotly animation : px.scatter does not display all continents

the issue

I would like to reproduce this animation : https://www.youtube.com/watch?v=WJscsV9uxZg

Here is the link to the jupyter notebook : https://colab.research.google.com/drive/1VAtvKwVoAGgg-6BcjsYg0jay_i6Z8oNQ

the case

I have built this data model that looks like this

df_all['continent'].unique()

returns

array(['Asia', 'Americas', 'Europe', 'Oceania', 'Africa'], dtype=object)
 
px.scatter(df_all, x="cases_sum_to_date", y="cases_growth", animation_frame="dateRep", animation_group="countriesAndTerritories",
           size="deaths_sum_to_date", color="continent", hover_name="countriesAndTerritories",
           log_x=False, size_max=50, range_x=[1,df_all['cases_sum_to_date'].max()], range_y=[-0.5,1]
)

displays

Questions

  1. 1 continent is present instead of 5, why?!?
  2. where is the reference documentation of the px.scatter?!? I can’t find the documentation of several parameters : animation_frame, animation_group

I have found the answer:

1/ Asia is the first continent impacted by COVID-19
2/ px.scatter DOES NOT display the continent that DO NOT contain time series since day 1

the solution

A/ fill the DataFrame with data containing 0 cases and fatalities from day 1

proposal for Plotly team

To adapt the charts to display all data and fill automatically with non-impacting data the missing time series