mplfinance icon indicating copy to clipboard operation
mplfinance copied to clipboard

Add more dates to X axis?

Open TraderMan999 opened this issue 2 years ago • 4 comments

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?

TraderMan999 avatar May 08 '22 20:05 TraderMan999

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.

DanielGoldfarb avatar May 13 '22 14:05 DanielGoldfarb

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: @.***>

TraderMan999 avatar May 15 '22 03:05 TraderMan999

@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)

ZX2XZX2 avatar Jun 13 '22 05:06 ZX2XZX2

Thx I’ll give it a try!

TraderMan999 avatar Jun 13 '22 16:06 TraderMan999