Last active
August 14, 2017 11:10
-
-
Save jsierles/6032fa8f93592554f08f5893cafe833d to your computer and use it in GitHub Desktop.
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
# setting up the layout of matplotlib figure | |
fig, ax = plt.subplots() | |
# use the distplot function from seaborn to plot the distribution of AAPL | |
sns.distplot(AAPL['Daily Return'].dropna(), color = 'indianred', | |
hist_kws=dict(alpha = 0.7)) | |
# remove the plot borders | |
sns.despine() | |
#get the plotly json object | |
fig = plotly.tools.mpl_to_plotly(fig) | |
# polish the histogram plot | |
fig['data'][1]['marker']['line']['color'] = 'white' | |
fig['data'][1]['marker']['line']['width'] = 1 | |
# controlling the size of the figure and adding title | |
fig['layout'].update(title = "AAPL Daily Return Distribution", | |
width = 850, height = 450, | |
xaxis = dict(showgrid=False)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment