Skip to content
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

Date Time Plot Limits Bug #138

Closed
ineteye opened this issue Oct 6, 2022 · 7 comments
Closed

Date Time Plot Limits Bug #138

ineteye opened this issue Oct 6, 2022 · 7 comments

Comments

@ineteye
Copy link

ineteye commented Oct 6, 2022

Hi!

2.Is there any way to add margin or offset from plot sides?

image

THANKS!!!!

@ineteye ineteye closed this as completed Oct 6, 2022
@piccolomo piccolomo changed the title Join Time Gaps on CandleStick Join WeekEnd Time Gaps on CandleStick, Add Plot Margins and Plot OHLC bars Oct 6, 2022
@piccolomo
Copy link
Owner

piccolomo commented Oct 6, 2022

Using xlim() and ylim() functions (here). Those functions should accept string dates as well.

@piccolomo piccolomo changed the title Join WeekEnd Time Gaps on CandleStick, Add Plot Margins and Plot OHLC bars Join WeekEnd Time Gaps and OHLC Plot Oct 6, 2022
@ineteye
Copy link
Author

ineteye commented Oct 6, 2022

Sorry can not make xlim to work, plot was based on this example code:

import yfinance as yf
import plotext as plt

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

dates = plt.datetimes_to_string(data.index)

plt.xlim(-1)

plt.candlestick(dates, data)
plt.show()
  • i was trying to use like :
    plt.xlim(-1),plt.xlim(-80) -- works but not how expected
    plt.xlim(-1,1) ,plt.xlim(-1,2) ..... ---- always get list index out of range
  • len(dates)= 83

Can you please help, i want add padding 1 bar from left and right

@piccolomo
Copy link
Owner

piccolomo commented Oct 6, 2022

Hi @ineteye,

thanks for the report as you were right, there was no date time support for the xlim() and ylim() functions. I just added it on the GitHub version 5.2.8 (instruction on how to install it here).

This now should work:

import yfinance as yf
import plotext as plt
plt.clf()
plt.date_form('d/m/Y')
start = plt.string_to_datetime('11/04/2022')
end = plt.today_datetime()
data = yf.download('goog', start, end)
dates = plt.datetimes_to_string(data.index)
plt.xlim("01/04/2022", "15/10/2022")
plt.candlestick(dates, data)
plt.show()

image

Does it help?

@piccolomo piccolomo changed the title Join WeekEnd Time Gaps and OHLC Plot Date Time Plot Limits Bug | Feature Requests: Join WeekEnd Time Gaps and OHLC Plot Oct 6, 2022
@ineteye
Copy link
Author

ineteye commented Oct 6, 2022

Thanks!!! Will wait while it will be available on upgrade :)

Right now still 5.2.7
image

@piccolomo
Copy link
Owner

piccolomo commented Oct 6, 2022

Try: pip install git+https://github.com/piccolomo/plotext for GitHub version 5.2.8 (as detailed here).

For all other aspects of this issue, feel free to reopen it. to make sure are not forgotten.

@ineteye
Copy link
Author

ineteye commented Oct 6, 2022

Thanks again! Now works fine :)))

@piccolomo piccolomo changed the title Date Time Plot Limits Bug | Feature Requests: Join WeekEnd Time Gaps and OHLC Plot Date Time Plot Limits Bug Oct 14, 2022
Repository owner deleted a comment from ineteye Oct 27, 2022
Repository owner deleted a comment from ineteye Oct 27, 2022
Repository owner deleted a comment from ineteye Oct 27, 2022
Repository owner deleted a comment from ineteye Oct 27, 2022
@piccolomo
Copy link
Owner

piccolomo commented Oct 27, 2022

Hi @ineteye, I have cleaned this issue and moved sub requests to other issues for clarity in case some other users need to find it.

Thanks for reporting and any other report is very welcomed! :-)
Savino

Repository owner deleted a comment from ineteye Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants