Skip to content

During horizontal scrolling, sometimes daily candles disappear #103

@haimivan

Description

@haimivan

Hi,

when the resolution of the plot is at the point where the daily candles are just visible, I observe their candle bodies to disappear during horizontal scrolling.

It would be very helpful if they would be visible in all situations.

Please find below the code and the referring video.

Thanks in advance!

code

#!/usr/bin/env python3

from datetime import date, timedelta
import finplot as fplt
import pandas as pd
import scipy.optimize
import yfinance as yf

now = date.today()
start_day = now - timedelta(days=59)
df = yf.download('GOOG', start_day.isoformat(), now.isoformat(), interval='5m')

import pytz

fplt.display_timezone = pytz.timezone('UTC')

# resample to daily candles, i.e. five 90-minute candles per business day
dfd = df.Open.resample('D').first().to_frame()
dfd['Close'] = df.Close.resample('D').last()
dfd['High'] = df.High.resample('D').max()
dfd['Low'] = df.Low.resample('D').min()

ax = fplt.create_plot('Alphabet Inc.', rows=1)

# plot down-sampled daily candles first
if True:
    daily_plot = fplt.candlestick_ochl(dfd.dropna(), candle_width=5)
    daily_plot.colors.update(dict(bull_body='#bfb', bull_shadow='#ada', bear_body='#fbc', bear_shadow='#dab'))
    daily_plot.x_offset = 3.03  # resample() gets us start of day, offset +1.1 (gap+off center wick)

# plot high resolution on top
fplt.candlestick_ochl(df[['Open', 'Close', 'High', 'Low']])

fplt.autoviewrestore(True)

fplt.show()

video + .ini file:

simplescreenrecorder-2021-01-02_07.50.26.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions