matplotlib / mplfinance

Financial Markets Data Visualization using Matplotlib
https://pypi.org/project/mplfinance/
Other
3.58k stars 621 forks source link

Add more dates to X axis? #528

Open TraderMan999 opened 2 years ago

TraderMan999 commented 2 years ago

Is there a way in the api to add more dates on the x axis? This helps me avoid having to count candles from the candles plotted and the sparsely populated candle dates.

I’ve been through the docs and may be overlooking it. This would be very helpful.

Also, does it plot “blue raindrops” like is done on trend spider?

DanielGoldfarb commented 2 years ago

Is there a way in the api to add more dates on the x axis?

No. I am presently working on an enhancement that will make this possible. Hopefully it will be done within a few weeks, however I found that I am being distracted by other projects lately and then have to come back to this enhancement. Check back in a couple of weeks for status.

... plot “blue raindrops” like is done on trend spider?

No. Will have to look into this. It appears that "Raindrop Charts" is a Trademark owned by Trend Spider. I will take a look at the white paper when I have some time. Between the Trademark name, and the possibility that the algorithm is copyrighted, we will have to see if this can be done without any infringement.

TraderMan999 commented 2 years ago

Thank you for the response. Can’t wait to see the new feature!!!

Get Outlook for iOShttps://aka.ms/o0ukef


From: Daniel Goldfarb @.> Sent: Friday, May 13, 2022 9:48:38 AM To: matplotlib/mplfinance @.> Cc: TraderMan999 @.>; Author @.> Subject: Re: [matplotlib/mplfinance] Add more dates to X axis? (Issue #528)

Is there a way in the api to add more dates on the x axis?

No. I am presently working on an enhancement that will make this possible. Hopefully it will be done within a few weeks, however I found that I am being distracted by other projects lately and then have to come back to this enhancement. Check back in a couple of weeks for status.

... plot “blue raindrops” like is done on trend spider?

No. Will have to look into this. It appears that "Raindrop Charts" is a Trademark owned by Trend Spiderhttps://trendspider.com/product/raindrops/. I will take a look at the white paperhttps://drt8s3xkrl8yg.cloudfront.net/1/assets/whitepapers/raindrops_280519.pdf when I have some time. Between the Trademark name, and the possibility that the algorithm is copyrighted, we will have to see if this can be done without any infringement.

— Reply to this email directly, view it on GitHubhttps://github.com/matplotlib/mplfinance/issues/528#issuecomment-1126140525, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZCNE6K2SS6SXSGOKEXOYWTVJZTUNANCNFSM5VMMIIFQ. You are receiving this because you authored the thread.Message ID: @.***>

ZX2XZX2 commented 2 years ago

@TraderMan999: this code will add more dates to the x-axis; it will label every Monday (df is the dataframe you want to chart):

fig = mpf.figure(figsize=(10, 6), style='yahoo')
ax1 = fig.add_subplot(3, 1, (1, 2))
ax2 = fig.add_subplot(3, 1, 3, sharex=ax1)
fig.subplots_adjust(hspace=0)
xticks, xticklabels = [], []
mth = -1
for i, dt in enumerate(df.index):
    if dt.dayofweek == 0:
        xticks.append(i)
        if dt.month != mth:
            mth = dt.month
            xticklabels.append(datetime.strftime(dt, '%b %d'))
        else:
            xticklabels.append(datetime.strftime(dt, '%d'))
        ax1.set_xticks(xticks)
        ax1.set_xticklabels(xticklabels)
mpf.plot(df, type='candle', ax=ax1, volume=ax2, axtitle=title)
TraderMan999 commented 2 years ago

Thx I’ll give it a try!