<jupyter_start><jupyter_text>Plotly - Create Linechart **Tags:** plotly chart linechart trend dataviz yahoofinance naas_drivers snippet **Author:** [<NAME>](https://www.linkedin.com/in/ACoAAAJHE7sB5OxuKHuzguZ9L6lfDHqw--cdnJg/) Learn more on the Plotly doc : https://plotly.com/python/line-charts/  Input  Import libraries<jupyter_code>import naas
from naas_drivers import yahoofinance, plotly<jupyter_output><empty_output><jupyter_text>Variables<jupyter_code>title = "Linechart"

# Output paths
output_image = f"{title}.png"
output_html = f"{title}.html"<jupyter_output><empty_output><jupyter_text>Get data<jupyter_code>date_from = -360 # Date can be number or date or today
date_to = "today"
df = yahoofinance.get("TSLA",
                      date_from=date_from,
                      date_to=date_to)
df<jupyter_output><empty_output><jupyter_text>Model<jupyter_code>fig = plotly.linechart(df,
                       x="Date",
                       y=["Open", "Close"],
                       title=title,
                       yaxis_title="Price in $")<jupyter_output><empty_output><jupyter_text>Output  Export in PNG and HTML<jupyter_code>fig.write_image(output_image, width=1200)
fig.write_html(output_html)<jupyter_output><empty_output><jupyter_text>Generate shareable assets<jupyter_code>link_image = naas.asset.add(output_image)
link_html = naas.asset.add(output_html, {"inline":True})

#-> Uncomment the line below to remove your assets
# naas.asset.delete(output_image)
# naas.asset.delete(output_html)<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup