matplotlib / mplfinance

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

The example image of price-movement_plots.ipynb is inconsistent with the displayed result. #665

Closed Minor-babe closed 3 months ago

Minor-babe commented 3 months ago

I use mplfinance to generate PNF charts, referring to the example in price-movement_plots.ipynb. I downloaded the SPY_20110701_20120630_Bollinger.csv file as the data source. My code is as follows:

import mplfinance as mpf import pandas as pd

daily = pd.read_csv('SPY_20110701_20120630_Bollinger.csv',index_col=0,parse_dates=True) daily.index.name = 'Date' mpf.plot(daily, type='pnf')

Based on the result image provided in price-movement_plots.ipynb, my expected output should look like this: 2024-04-01 16-14-49

But actually, the image I get is: Figure_1

my mplfinance version: v0.12.10b0.

Please inform me, what caused this? Did the data change?

DanielGoldfarb commented 3 months ago

@Minor-babe

Point and Figure was rewritten about 16 months ago (https://github.com/matplotlib/mplfinance/releases/tag/v0.12.9b7) (Dec 08, 2022).

It appears that price-movement_plots.ipynb was not regenerated at the time (but is from Apr 11, 2021, before the rewrite).

So at a glance, I would say that the plot you are getting is correct, while the one displayed on github is wrong.

That said, it does appear that you may have some issues with the font display on the axis labels of your plot. That could be if matplotlib can't find the font that it wants to use.

I will try to make the time soon to re-generate the price-movement_plots notebook and post it to the repository.

DanielGoldfarb commented 3 months ago

I re-ran the price-movement_plots.ipynb notebook on my local machine and I am getting a plot that matches yours. I believe this is the correct plot:

image

DanielGoldfarb commented 3 months ago

I just updated the repository with the regenerated price-movements notebook.