Created
November 22, 2019 04:07
-
-
Save amitrani6/ebc3f9a3b4da861b8ed4ed5b88bea269 to your computer and use it in GitHub Desktop.
Solo Growth Rate Chart with Plotly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plotly Growth Rate Chart For The Campbell Soup Company | |
# Calculate Growth Rate | |
cpb['growth_rate'] = cpb['Adj Close'].pct_change() | |
s_and_p['growth_rate'] = s_and_p['Adj Close'].pct_change() | |
fig = go.Figure() | |
# You can add multiple traces, in this case financial securities | |
fig.add_trace(go.Scatter(x=cpb.Date, y=cpb['growth_rate'], | |
name="Campbell Soup Company", line_color='deepskyblue', hovertext=cpb["Adj Close"])) | |
fig.update_layout(title_text='CPB Growth Rates From November 21, 2018 to November 21, 2019', | |
title={ | |
'y':0.9, | |
'x':0.5, | |
'xanchor': 'center', | |
'yanchor': 'top'}, | |
xaxis_rangeslider_visible=True, xaxis_title="Time", yaxis_title="Growth Rate Percentage") | |
fig.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment