Skip to content

Bug Report: #346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
HourGlss opened this issue Feb 28, 2021 · 3 comments
Closed

Bug Report: #346

HourGlss opened this issue Feb 28, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@HourGlss
Copy link

Describe the bug
mpf.plot(data,type="candle") generates a line graph.

To Reproduce
Steps to reproduce the behavior:
create OHLC dataframe... something like this:

Date Close Open Volume High Low
2021-02-12 07:05:00 134.6100 134.68 11829 134.72 134.59
2021-02-12 07:10:00 134.5300 134.63 6182 134.63 134.50
2021-02-12 07:15:00 134.5900 134.55 7473 134.62 134.55
2021-02-12 07:20:00 134.6500 134.58 3938 134.65 134.57
2021-02-12 07:25:00 134.6600 134.66 3909 134.69 134.66
... ... ... ... ... ...
2021-02-26 19:35:00 121.8800 121.90 18794 121.90 121.80
2021-02-26 19:40:00 121.8000 121.88 23020 121.88 121.80
2021-02-26 19:45:00 121.8399 121.83 9625 121.85 121.76
2021-02-26 19:50:00 121.8300 121.81 9939 121.85 121.81
2021-02-26 19:55:00 121.7600 121.83 28145 121.86 121.69

[1883 rows x 5 column
then try to create candle graph
mpf.plot(df,type="candle")

Expected behavior
something resembling a candle graph is made

Screenshots
If applicable, add screenshots to help explain your problem.
image
This is made. No errors of any kind

Desktop (please complete the following information):

  • OS: Windows 10
  • Version mplfinance~=0.12.7a7
  • python3.8
@HourGlss HourGlss added the bug Something isn't working label Feb 28, 2021
@DanielGoldfarb
Copy link
Collaborator

This is not a bug. Rather you are trying to plot more data than the size of your plot and resolution of your screen can handle.
(Over 1800 candles in just a few inches across your screen can be difficult to see).

You can try making your plot larger, and/or plotting fewer candles, or resampling:

Please click here and carefully read through this issue and then let me know if you have any further questions.

Thanks.

@HourGlss
Copy link
Author

HourGlss commented Mar 2, 2021

It most certainly is a bug. I specified candles and got a line.

The fact that you can explain why it's happening and point to possible solutions does not mean it's not a bug. There is no warning on why its happening, and no way to know how to fix it if it does happen.

@DanielGoldfarb
Copy link
Collaborator

It most certainly is a bug. I specified candles and got a line.

  • You do NOT have a line. You DO have candles.
  • The candles are too small on your screen for you to see.

You are plotting 1883 candles. Think of it this way: Let's say your monitor is 24 inches wide (and let's assume your monitor has more than enough pixels, say 20,000 pixels across, to clearly draw the candles). That means each candle is going to be less than 0.0127 inches wide. That's about 1/3 of millmeter. While possible to see, if you look very closely, it will still be difficult for your eye to see each candle as anything more than a small line (being as your eye would need to distinguish 3 candles in the space of 1 millimeter!)

Now consider your monitor. What is the resolution of your monitor? Mine is basic HD, or 1920x1080. On my monitor, 1883 candles means each candle is going to be about 1 pixel wide (with no space between candles). Thus it impossible for the monitor to draw a candle.

Presently, the maximum resolution monitor available to consumers is 8K, which is 7680 x 4320 pixels: this monitor will have only 4 pixels with which to draw the width of each candle, or 3 pixels if you leave 1 pixel of space between each candle.

Can you see clearly 4 pixels on your screen??

If you can find me a software package and consumer available monitor (or printer) that can clearly display 1883 candles in a single plot, then I will be willing to consider this a bug and do what I can to improve the mplfinance package.


There is no warning on why its happening, and no way to know how to fix it if it does happen.

This is perhaps a good point. I don't want to waste code to determine the resolution and size of the user's monitor, but I suppose mplfinance can make a reasonable guess as to when a user is attempting to plot more candles than can be displayed by any typical high-end computer, and perhaps issue a warning.

Please let me know if you have any further questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants