python - Date Index Formatter for Candlesticks -


I wanted to remove "interval" between weekends when I was able to do stock data graphing using matplotlib And the result is the following graph:

Enter image details here

Now, when I try to run index format on X-axis, I get only blank canvas. Can anyone figure out what I am doing wrong here? If I do everything again on the FuncFormatter line, I comment.

  Adjust # builder parameter dates for the candlestick graph so that charts x = 0 y = len (date) Ind = NP Ranges (y) candleAre = [] on X-lt While X & lt; Y: Appendable = x [x], OpenP [x], Clap [x], Hype [x], Low [x], Volume [x] CandleAr.Append (Expalline) x + = 1 DF Format_date (X, Pause = None): Thisind = np.clip (int (x + 0.5), 0, y-1) Backend CandleArrayad [Wond] .strftime ('% Y-% m-% d') #Defin Conspiracy Area and Candest Chart Fig = Plt.figure (facecolor = 'w') ax1 = plt.subplot2grid ((1,1), (0,0), axisbg = 'w') Candle (axis 1, candle ar, width = 0.8, color = ' # 9f15 ', Colordown =' # ff1717 ') ax1.xaxis.set_major_formatter (mticker.FuncFormatter (format_date) fig.autofmt_xdate () plt.show ()  

format_date function to do this work here:

  def format_date (x, Pos = none): newdate = mdates.num2date (date [int (x)] if newdate.strftime ('% m') == '02': return newdate.strftime ('% b \ N% Y') Other : Return newdate.strftime ('% b')  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -