Created
November 22, 2019 03:50
Revisions
-
amitrani6 created this gist
Nov 22, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ # A Plotly OHLC Chart With A Rangeslider # This code is adapted from the Plotly site # Source: https://plot.ly/python/ohlc-charts/ # Import the necessary libraries import pandas as pd import numpy as np # The section of the Plotly library needed import plotly.graph_objects as go # Obtain data from the data frame fig = go.Figure(data=go.Ohlc(x=cpb['Date'], open=cpb['Open'], high=cpb['High'], low=cpb['Low'], close=cpb['Close'])) # Add title and annotations fig.update_layout(title_text='CPB 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()