jessbuildsthings / f1-viz

Dash app for visualizing Formula 1 data.
MIT License
45 stars 4 forks source link

Driver Laptimes Distribution #12

Open alexdelli opened 1 year ago

alexdelli commented 1 year ago

Hi, is ti possible to integrate this kind of plot?

https://docs.fastf1.dev/examples_gallery/plot_laptimes_distribution.html#sphx-glr-examples-gallery-plot-laptimes-distribution-py

I don't understand how to adapt the code to your app

thank you

jessbuildsthings commented 1 year ago

It's possible and would likely work best on the 'Lap View' tab since it has a similar grain to the data on that page. I can add it to the backlog but might be slow to get to it given other priorities.

If you want to attempt it in the meantime, here is my gut reaction on what's needed:

  1. Add a placeholder for the graph to the content for the 'Lap View' tab.
  2. Add a function to plots.py that builds a Plotly figure using the laps dataframe (same input as the tyre strategy viz). Note: your example uses matplotlib and this is a Plotly/Dash app, so you'll need to translate it to Plotly's equivalent. I ask you to use go.Violin (not px.violin) so it can be customized as needed down the road.
  3. Update the callback that renders the 'Lap View' tab to call the function you wrote in (2) and output its contents to the figure you created in (1).