question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: Join WeekEnd Time Gaps in Candlestick Plot and Custom Data Columns

See original GitHub issue

Hi!

I found the easiest solution to have a plot without holes For that I have to add a new column with merged dates, this solution is fine if you do not need the right dates.

1.I think easiest way to add this feature to PloText is to add second index which will be just counter Counter will be used for plotting without holes and Date column will be used for Displaying dates on plot

2.Additional will be awesome to add custom naming for columns, ‘Date’,‘Open’,‘High’,‘Low’,‘Close’ not the only one, lot of data feeds name columns as ‘t’,‘o’,‘h’,‘l’,‘c’

P.S. I’m not a Pandas expert so there should be much better way to create a new index column.

import yfinance as yf
import plotext as plt

plt.date_form('d/m/Y')
start = plt.string_to_datetime('11/08/2022')
end = plt.string_to_datetime('10/10/2022')
data = yf.download('goog', start, end)


Merge=True
if Merge:
    l=[]
    import time
    import datetime
    d0=time.mktime(data.index[0].timetuple()) # Start Date
    for i,d in enumerate(data.index):
        l.append(datetime.datetime.fromtimestamp(d0+i*86400))
    data['index']=l # Add our merged dates to pandas dataframe
    data=data.reset_index(drop=False) # Reset index with saving index data
    data=data.set_index('index') # Set new dataframe index for timeline


dates = plt.datetimes_to_string(data.index)
plt.candlestick(dates, data,yside = 2)
plt.show() 

Merge=False

image

Merge=True image

Pandas : image

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
piccolomocommented, Oct 15, 2022

Hi @ineteye, I will come back to this later on. Thanks for updating about it! All the best, Savino.

1reaction
ineteyecommented, Oct 14, 2022

Checked mplfinance candlestick plots and they did not use column naming at all. Stock data always in format like that: ‘Date’,‘Open’,‘High’,‘Low’,‘Close’,‘Volume’ Column naming maybe different but order always like that, best options will be to use column order and not naming at all.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plotting candlestick with matplotlib for time series w/o ...
As I understand, you want to plot candlestick chart with no gaps and to make xlables actual dates instead of integers. In order...
Read more >
Candlestick gaps · Issue #1545 · altair-viz/altair
This usually has no data at weekends. Currently Altair's candlestick chart plots with gaps at weekends, which I've depicted using the red ...
Read more >
How to Remove Weekend date data from stock candlestick ...
Dear Support, In the stock candle stick chart, we want to remove the weekend dates as no data will be available here. In...
Read more >
Candlestick charts - Google Docs Editors Help
Use a candlestick chart to show the low, high, opening, and closing values of a security for a specific period. For example, get...
Read more >
Timelines | Charts
One popular type of timeline is the Gantt chart. ... In this code, we've inserted a new column into our data to hold...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found