9 - DeclinationCodeinTextformat
9 - DeclinationCodeinTextformat
/usr/bin/env python
# coding: utf-8
# In[1]:
import chart_studio.plotly as py
import plotly.graph_objs as go
from plotly.tools import FigureFactory as FF
import numpy as np
import pandas as pd
import plotly.express as px
# In[2]:
# In[3]:
start_date = '01-21-2006'
end_date = '10-15-2010'
# In[4]:
plan2 = pd.read_csv(r"C:\\Python369\\Scripts\\EXCEL\Nifty2005TO2022.csv")
# In[5]:
df5 = pd.DataFrame(plan2)
# In[6]:
df5['date'] = pd.to_datetime(df5['Date'])
# In[7]:
df5.index = df5['date']
# In[8]:
dfClose=df5[start_date:end_date]#DATE
# In[9]:
planet = pd.read_csv("C:\\Python369\\Scripts\\EXCEL\Sumplanet.csv")
# In[10]:
df2 = pd.DataFrame(planet)
# In[11]:
df2['date'] = pd.to_datetime(df2['Date'])
# In[12]:
df2.index = df2['date']
# In[13]:
df3=df2[start_date:end_date]
# In[14]:
df3.head()
# In[16]:
trace1 = (go.Candlestick(x=dfClose.index,#main
open=dfClose['Open'],
high=dfClose['High'],
low=dfClose['Low'],
close=dfClose['Close']))
trace3 = go.Scattergl(
x = df3.index,
y = df3[' DEC_SUN'],
mode = 'lines',
name = 'DEC_SUN',
yaxis = 'y3'
)
trace4 = go.Scattergl(
x = df3.index,
y = df3['DEC_MARS'],
mode = 'lines',
name = 'DEC_MARS',
yaxis = 'y3'
)
trace14 = go.Scattergl(
x = df3.index,
y = df3['DEC_MOON'],
mode = 'lines',
name = 'DEC_MOON',
yaxis = 'y3'
)
trace5 = go.Scattergl(
x = df3.index,
y = df3['DEC_VENUS'],
mode = 'lines',
name = 'DEC_VENUS',
yaxis = 'y3'
)
trace6 = go.Scattergl(
x = df3.index,
y = df3[' DEC_SATURN'],
mode = 'lines',
name = ' DEC_SATURN',
yaxis = 'y3'
)
trace7 = go.Scattergl(
x = df3.index,
y = df3['DEC_URANUS'],
mode = 'lines',
name = 'DEC_URANUS',
yaxis = 'y3'
)
trace8 = go.Scattergl(
x = df3.index,
y = df3[' DEC_JUPITER'],
mode = 'lines',
name = ' DEC_JUPITER',
yaxis = 'y3'
)
trace9 = go.Scattergl(
x = df3.index,
y = df3[' DEC_MERCURY'],
mode = 'lines',
name = ' DEC_MERCURY',
yaxis = 'y3'
)
trace10 = go.Scattergl(
x = df3.index,
y = df3[' DEC_NEPTUNE'],
mode = 'lines',
name = ' DEC_NEPTUNE',
yaxis = 'y3'
)
data = [trace1,trace3,trace9]
layout = go.Layout(
title='multiple y-axes example',
width=1700,
height=900,
xaxis=dict(
rangeselector=dict(
buttons=list([
dict(count=1,
label='1m',
step='month',
stepmode='backward'),
dict(count=6,
label='6m',
step='month',
stepmode='backward'),
dict(count=1,
label='YTD',
step='year',
stepmode='todate'),
dict(count=1,
label='1y',
step='year',
stepmode='backward'),
dict(step='all')
])
),
rangeslider=dict(
visible = True
),
type='date'
),
yaxis=dict(
title='yaxis title',
showgrid=False,
tickmode='linear',
ticks='outside',
tick0=0,
dtick=30,
ticklen=8,
tickwidth=4,
tickcolor='#000',
titlefont=dict(
color='#1f77b4'
),
tickfont=dict(
color='#1f77b4'
)
),
yaxis2=dict(
title='yaxis2 title',
showgrid=False,
titlefont=dict(
color='#ff7f0e'
),
tickfont=dict(
color='#ff7f0e'
),
anchor='free',
overlaying='y',
side='left',
position=0.50
),
yaxis3=dict(
title='yaxis4 title',
showgrid=False,
titlefont=dict(
color='#d62728'
),
tickfont=dict(
color='#d62728'
),
anchor='x',
overlaying='y',
side='right'
)
# In[ ]: