You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found myself looking at trends and wanting to pseudo forecast them into the future by simply mouse over-ing at some future date. However, since that date is not in the DataFrame, there is neither tick marks nor the x,y display that is shown for all of the data.
I hacked together a solution by modifying the IntegerIndexDateTimeFormatter, which solves both tick marks and the x,y display.
I thought I'd post here in case it is useful to anyone else. I'm not sure if I know mplfinance well enough to know if it breaks other things or if it is worth creating a pull request.
Mike,
Thanks. This looks interesting. There is a similar solution here but that solution is only for adding small amounts of extra time (small enough that additional ticks and tick labels are not needed; otherwise they would repeat the existing date labels).
I will try to make some time next week to review and make sure this won't break anything else.
In the meantime, can you please provide a one or two use-cases, i.e. specific code examplse with their data, so that I can know clearly what you are seeing and what you expect?
Here is the simple example I'm looking at with and without the change. Without the change, no tick marks show up. I usually get to this scenario from manually zooming and panning the matplotlib figure.
(Note that the screen capture didn't grab my mouse cursor, but in both cases it is to the right of where data exists.)
Thanks. I started playing with this. I think you are on the right track. However this solution works only for daily data. I'm going to try to come up with a solution that works for all frequencies of data (per minute, per hour, daily, weekly, etc.) This may be tricky because, in theory users can pass in data of no particular frequency: just a bunch of random dates (in time order) with ohlcv data associated with each date passed in.
In the meantime, a workaround is to set kwarg show_nontrading=True. With this set, matplotlib will automatically format tics for all datestimes as neeeded.
I found myself looking at trends and wanting to pseudo forecast them into the future by simply mouse over-ing at some future date. However, since that date is not in the DataFrame, there is neither tick marks nor the x,y display that is shown for all of the data.
I hacked together a solution by modifying the
IntegerIndexDateTimeFormatter
, which solves both tick marks and the x,y display.I thought I'd post here in case it is useful to anyone else. I'm not sure if I know mplfinance well enough to know if it breaks other things or if it is worth creating a pull request.
https://github.com/mikessut/mplfinance/tree/dates_bynd_data
The text was updated successfully, but these errors were encountered: