Skip to content

Plotting Too Much Data

Daniel Goldfarb edited this page Mar 5, 2021 · 41 revisions

Plotting Too Much Data

  • Sometimes, without realizing it, users plot so much data that it becomes impossible to see the detailed shapes of candles or ohlc-bars.
    • In such a case, it is easy to think that you have a line plot instead of candles, as shown below:


How many candles are too many to see?

  • How many is "Too Many" depends primarily on the size of your plot, and on the resolution of your monitor (or printer).
  • The Above image shows 500 candles.
  • Below is the exact same 500 candle plot made full screen on a 27 inch monitor with basic HD (1920 x 1080) resolution.
  • Notice that now, at full screen, you can somewhat make out the appearance of candles:


Is there something wrong with Mplfinance?

  • No. The limitations on being able to see candle detail for many candles at once, are due primarily to two things:
    • the limitations of human eyesight.
    • the current state of computer graphics technology

Consider plotting 1800 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.


What Can You Do About Plotting So Much Data?

  • There are a number of things that can be done, including:

    • use type=line
    • plot less data
    • interactive zoom
    • resample data
  • The Images Below show 2000 rows of ohlc data, first as type='candle' and then as type='line'.

    • When taking such a "big picture view" of your data, perhaps a line chart is adquate:

  • Ask yourself, if you want to take a "big picture view" of your data (in this case over 7 years worth), ask yourself if seeing the individual one day at a time candle patterns will really make a difference to you. The question applies to viewing say 1 week of 1 minute candles (also approximately 2000 data points). Perhaps if looking at 7 years of trading, then weekly (instead of daily) candles are more appropriate. Or for 5 days of intraday trading, perhaps 5 minute (instead of 1 minute) intervals are just as useful for that long of a stretch of time.

If not, then perhaps use a line chart. If yes, then consider resampling your data, so that each candle represents, not one day, but one week, or one month, etc.

Clone this wiki locally