0

The candlestick graph in the last line of code does not display correctly. Instead all that is displayed is a white background. How can I fix it?

from pandas_datareader import data
import pandas as pd
import numpy as np
import datetime
import yfinance as yf
yf.pdr_override()

%matplotlib inline

start = datetime.datetime.now() - datetime.timedelta(days = 365*5)
end = datetime.datetime.now()

GS = yf.download("GS", start,end)

import matplotlib.pyplot as plt
sns.set_style('whitegrid')

from plotly import __version__

import cufflinks as cf

from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot

init_notebook_mode (connected=True)

cf.go_offline()

GS[['High', 'Low', 'Open', 'Close']]['2016-06-17':'2021-06-15'].iplot(kind="candle")
James
  • 1
  • 1
  • Not unless you clarify what "isn't working" means. Error messages / crashes / expected behaviour? – Alexey S. Larionov Jun 17 '21 at 09:02
  • When you run the code the iplot graph doesn't display. It only shows a white background with no graph. No error messages / crashes just semantic issues. – James Jun 17 '21 at 10:23
  • The code contains invalid python code (`%matplotlib inline`). Make sure the code is exactly as your current code and that it showcase the problem you have, i.e. create a [mre]. Also, go through the [tour]. You're missing many useful tags that you can add to your question to make it more clear and attract people with correct domain knowledge. – Ted Klein Bergman Jun 17 '21 at 10:37
  • Thanks @TedKleinBergman! I've added more tags and corrected my post. – James Jun 17 '21 at 10:43
  • I'm not sure if your runtime environment is Notebook or not, but the solution requires the functions and preferences described in [this answer](https://stackoverflow.com/questions/52859983/interactive-matplotlib-figures-in-google-colab). You can combine your code with the code in the answer to see the graph. – r-beginners Jun 18 '21 at 04:04
  • You can find the code in [Google Colab](https://colab.research.google.com/drive/1FSv72gMmgwjM5x6fJckqIs3mHlgjEDZC?usp=sharing). Please try to run this content. If it solves the problem, I will reply with this code. – r-beginners Jun 18 '21 at 04:04
  • That works thank you so much r-beginners! – James Jun 18 '21 at 06:40
  • Yes that's perfect! Thank you so much :). – James Jun 19 '21 at 09:32

0 Answers0