Hi,
I have problems with JupyterLab and plotly. When I use the code below, the chart is not displayed (large white space below). I tried to follow these Troubleshooting instructions (https://plot.ly/python/troubleshooting/) and many other things but it still doesn’t work. The same when I try to save as svg - fig(“svg”), while orca is installed.
Thanks in advance for your help
import pandas as pd
import numpy as np
from plotly.subplots import make_subplots
import plotly.graph_objects as go
import technical_analysis as tech
Import Data
df = pd.read_excel(‘C:/Users/Admin/Desktop/Python/TA.xlsx’, header=[4,5], index_col=0)
Define stock or index for technical analysis
stock = “S&P 500”
Calculate the technical indicators
rsi = tech.RSI(df[stock][“Close”])
stoch = tech.Stoch(df[stock][“High”],df[stock][“Low”],df[stock][“Close”])
tsi = tech.TSI(df[stock][“High”])
macd = tech.MACD(df[stock][“Close”])
Plot results
fig = make_subplots(rows=2, cols=1)
fig.add_trace(go.Scatter(
x=[rsi.index],
y=[rsi],
mode=‘lines’)
, row=1, col=1)
fig.add_trace(go.Scatter(
x=[tsi.index],
y=[tsi],
mode=‘lines’)
, row=2, col=1)
fig.show()