1

I'm still a newbie to matplotlib. Currently, I have below dataset for plotting:

Date Open High Low Close Trade_Date 2018-01-02 736696.0 42.45 42.45 41.45 41.45 2018-01-03 736697.0 41.60 41.70 40.70 40.95 2018-01-04 736698.0 40.90 41.05 40.20 40.25 2018-01-05 736699.0 40.35 41.60 40.35 41.50 2018-01-08 736702.0 40.20 40.20 37.95 38.00 2018-01-09 736703.0 37.15 39.00 37.15 38.00 2018-01-10 736704.0 38.70 38.70 37.15 37.25 2018-01-11 736705.0 37.50 37.50 36.55 36.70 2018-01-12 736706.0 37.00 37.40 36.90 37.20 2018-01-15 736709.0 37.50 37.70 37.15 37.70 2018-01-16 736710.0 37.80 38.25 37.45 37.95 2018-01-17 736711.0 38.00 38.05 37.65 37.75 2018-01-18 736712.0 38.00 38.20 37.70 37.75 2018-01-19 736713.0 36.70 37.10 35.30 36.45 2018-01-22 736716.0 36.25 36.25 35.50 36.10 2018-01-23 736717.0 36.20 36.30 35.65 36.00 2018-01-24 736718.0 35.80 36.00 35.60 36.00 2018-01-25 736719.0 36.10 36.10 35.45 35.45 2018-01-26 736720.0 35.50 35.75 35.00 35.00 2018-01-29 736723.0 34.80 35.00 33.65 33.70 2018-01-30 736724.0 33.70 34.45 33.65 33.90

I've converted the date value to number using mdates.date2num

After that, I've tried to plot candlestick graph with codes below:

    f1, ax = plt.subplots(figsize= (10,5))

   candlestick_ohlc(ax, ohlc.values, width=.6, colorup='red', colordown='green')
    ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d'))
    plt.show()

However, I'm still getting the graph with gaps. I've tried the possible solution from How do I plot only weekdays using Python's matplotlib candlestick?

However, I was not able to solve my problem with the solution above.

Can anyone kindly help me with this issue?

Thanks!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.