Hi,
I’m pretty new to Dash/Plotly and i have an app with scatter plots and dropdowns.
I want to add a feature to download data of a plot to csv. Is there a prebuilt feature for this ? How do you advise to implement this ?
Many thanks.
Hi,
I’m pretty new to Dash/Plotly and i have an app with scatter plots and dropdowns.
I want to add a feature to download data of a plot to csv. Is there a prebuilt feature for this ? How do you advise to implement this ?
Many thanks.
Hey @Lo96,
what are you referring to with download? The underlying data? Selected data? Data currently shown in the graph?
As far as I know, there is nothing built-in for that. That said, all I mentioned above should be possible with dash
.
To build on @AIMPED 's answer, to download data plotted in the graph, you can save the filtered pandas dataframe to csv:
import pandas as pd
import plotly.express as px
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/2014_apple_stock.csv')
fig = px.line(df, x = 'AAPL_x', y = 'AAPL_y', title='Apple Share Prices over time (2014)')
df_filtered = df.loc[:,['AAPL_x','AAPL_y']]
print(df_filtered)
df_filtered.to_csv("my-data")
fig.show()