Raceplotly library

does dash support raceplotly.plots? I am trying to create a race barplot and integrate it with the dash app. I’m getting an error loading the layout.

hi @Navaneeth
:wave: welcome to the community

Have you been able to get raceplotly to work on its own, outside of Dash? if so, can you share the code?

Hey @adamschroeder thanks for getting back to me. I really appreciate it.

fig3= barplot(fillna_values,  item_column='CountryName', value_column='ConfirmedCases', time_column='Date')
fig3.plot(item_label = 'Top Country', value_label = 'cases', frame_duration = 600) 

this is the code for race plot. I have watched your videos on YouTube and from AI Planet to create a barplot. But this library makes it easier to handle data. I have created a bar raceplot in the way you taught. But as I mentioned this library makes it easier. This is the GitHub link GitHub - Navaneeth25/TestingApp: To test the dash app through render for the dash I’m trying to create.

ok, I’m not sure it would work inside Dash unless it works successfully outside of it. And I can’t get it to work.

Let’s start small. Can you take your github code and diminish it so we have just a small sample with 5-10 lines of code that generates a race plot. Feel free to use the raw dataset like you do in the repo:

covid_dataset=pd.read_csv('https://raw.githubusercontent.com/Navaneeth25/covid_dataset/main/OxCGRT_summary20200520.csv')

Thanks for the clarification @adamschroeder Advance Plotly Plots | AI Planet (formerly DPhi) I did manage to create using the method that you taught in the link I mentioned and managed to add buttons Intro to animations in Python. using this. I wanted to know if there is a way to add a race plot using the library that I mentioned.

I see what you mean. For that animated plot, yes, we can use that in Dash. Try this code.

from dash import Dash, html, dcc
import plotly.express as px


df = px.data.gapminder()
fig = px.scatter(df, x="gdpPercap", y="lifeExp", animation_frame="year", animation_group="country",
           size="pop", color="continent", hover_name="country",
           log_x=True, size_max=55, range_x=[100,100000], range_y=[25,90])

app = Dash(__name__)
app.layout = html.Div([
    html.Div("Title of Dash App"),
    dcc.Graph(figure=fig)])


if __name__ == "__main__":
    app.run_server(debug=True)

1 Like

I’m talking about this library raceplotly · PyPI @adamschroeder. I did manage to add animations in my dash app. But when I was trying to add the plot that I created using the library I mentioned there was an error loading the layout in dash.

Hello @Navaneeth,

Sure, this is available.

Check this out:

from dash import Dash, html, dcc

import pandas as pd
from raceplotly.plots import barplot

data = pd.read_csv('https://raw.githubusercontent.com/lc5415/raceplotly/main/example/dataset/FAOSTAT_data.csv')

my_raceplot = barplot(data,  item_column='Item', value_column='Value', time_column='Year')

my_raceplot.plot(item_label = 'Top 10 crops', value_label = 'Production quantity (tonnes)', frame_duration = 800)

app= Dash(__name__)

app.layout = html.Div(dcc.Graph(figure=my_raceplot.fig))

app.run(debug=True)
2 Likes

Thank you guys for helping me out @jinnyzor @adamschroeder. The above solution works.

1 Like