Open Tirbo06 opened 2 years ago
@Tirbo06 can you provide an image (maybe draw on it showing what you want, and/or indicating what it's doing that you don't want) so that I can be more certain i understand what you're asking?
There is a request to make vlines
available for all panels. It should be a relatively easy enhancement. Would you be willing to make the enhancement if I guide you through the process?
Okey, so I was able to plot the grid and adjust the 'minor' and 'major' by returning 'axes'. Here is the code for the GRID that helped me :
myfig, myaxs = mpf.plot(here, style=s, addplot=ap1, returnfig=True, **kwargs)
myaxs[0].minorticks_on()
myaxs[0].grid(which='both', linestyle=':', linewidth='1', color='gray')
# for the added plot (e.g indicators)
myaxs[2].minorticks_on()
myaxs[2].grid(which='both', linestyle=':', linewidth='0.5', color='gray')
How it was:
How it is now :
And i certainly missed a point on how to customize the frequency of the grid x axis
, I saw how to format (datetime to str etc) but how if we need the intraday infos like every 15 minutes ?
And here for the VLINES (image is cropped just for ease of display), so the goal is to have those vertical lines all the way down.
I never contributed before and i have no idea of what it implies and i have not a lot of experience with MPL. What do you think ?
https://github.com/matplotlib/mplfinance/issues/428#issuecomment-893826162
I see that you have a workaround for intraday but is there an update about this functionality?
Regarding the project you mentioned (https://github.com/matplotlib/mplfinance/issues/428#issuecomment-893826162) it seems that various small (and faster to implement) enhancements are repeatedly distracting from it. (Something comes up that would be a nice enhancement, and turns out easy to implement (1 to 3 days work) so I stop what I'm doing and do the nice quick enhancement. However, there is slow, gradual progress on the xticks enhancement; I just can't say at this point if it will be another 6 weeks, or another 6 months; most likely something in between.
In the meantime, as a workaround, you may try this:
set returnfig=True
then do the following:
fig, axlist = mpf.plot(df,...,returnfig=True)
for ax in axlist:
for vline in my_vlines:
ax.axvline(x=vline, linestyle='--')
mpf.show()
where my_vlines
is a sequence of x
values where you want the vertical lines to appear, however these x
values need to be the row number in your DataFrame (corresponding to the datetime where you want the vertical line).
Please try that and let me know how it works for you.
Regarding
I never contributed before and i have no idea of what it implies and i have not a lot of experience with MPL. What do you think ?
If you know the basics of using git
, then I can easily walk you through the process. It's a very good feeling to contribute to a project. I have honestly only been doing it a couple of years now, and was largely clueless my first time, but someone walked me through it and it's a piece of cake really.
Regarding the project you mentioned (#428 (comment)) it seems that various small (and faster to implement) enhancements are repeatedly distracting from it. (Something comes up that would be a nice enhancement, and turns out easy to implement (1 to 3 days work) so I stop what I'm doing and do the nice quick enhancement. However, there is slow, gradual progress on the xticks enhancement; I just can't say at this point if it will be another 6 weeks, or another 6 months; most likely something in between.
In the meantime, as a workaround, you may try this: set
returnfig=True
then do the following:fig, axlist = mpf.plot(df,...,returnfig=True) for ax in axlist: for vline in my_vlines: ax.axvline(x=vline, linestyle='--') mpf.show()
where
my_vlines
is a sequence ofx
values where you want the vertical lines to appear, however thesex
values need to be the row number in your DataFrame (corresponding to the datetime where you want the vertical line).Please try that and let me know how it works for you.
Hello Daniel, Thank you for your return, that worked perfectly ! π¦Ύ
Regarding the contribution for MPF vlines
now that I more deeply understand the logic, i am wondering if it not should stay as it is in order to let us control which panel we want the vlines
to appear on.
However, if you still plan to implement the functionality I will be honored to give it a try but I will not be able to work on it until April.
Let me know if it is ok for you ?
@Tirbo06 April is fine. I have a few other things I am working on as well. Regarding
... let us control which panel we want the
vlines
to appear on.
I was thinking something like this maybe:
vlines
as a kwarg to mpf.plot()
, by default are drawn on the main panel (as it is now).vlines
can also be a dict
, then the dict could also allow the keyword panels
which could be a list of panel numbers through which the vlines should be drawn, or could also be the sting 'all', to indicate all panels.mpf.make_addplot()
could also accept a vlines
kwarg, but in this case the dict version would not accept a panels
keyword because mpf.make_addplot()
already accepts a panel
kwarg. As a kwarg to mpf.make_addplot()
one can create different vlines on different panels.Hello Daniel ! Sorry for the delay, but i really can not free some time right now to dive into this. I will definitely come back to you when I have more time if it still not fix. Thanks again for your work and the good communication !
I would like to work on this project
@ateeq-code
Ateeq,
I'm glad to hear it. Do you need any information or guidance to get started? If not, then go ahead and describe your plan on how to implement this, or just write the code so we can take a look. Or if you need information or guidance, please let me know and we will guide you on how best to work on this project.
All the best. --Daniel
Hello, we are students from CMU-Q looking to contribute to open-source projects as part of our final homework assignment for foundations of software engineering.
We would like to ask for permission to work on this as well.
@facealtha Permission is granted. You should read through the code and then propose a solution to an Issue that is described in this repository.
Of course you need to first have some idea how to use this package. You can learn the package by going through the tutorials listed here.
seems like no one is working on this at the moment? I may have a go at this.
I was thinking something like this maybe:
vlines
as a kwarg tompf.plot()
, by default are drawn on the main panel (as it is now).- Since
vlines
can also be adict
, then the dict could also allow the keywordpanels
which could be a list of panel numbers through which the vlines should be drawn, or could also be the sting 'all', to indicate all panels.
having this API work as a kwarg for mpf.plot()
makes the most sense (to me). users can select specific panels the vline is displayed and "all" if desired.
mpf.make_addplot()
could also accept avlines
kwarg, but in this case the dict version would not accept apanels
keyword becausempf.make_addplot()
already accepts apanel
kwarg. As a kwarg tompf.make_addplot()
one can create different vlines on different panels.
this could be added later, if someone else desires this api. i don't foresee a use for me.
xD this came back to bite me... 6 months later... and I once again bump into this issue.
Hello Daniel, π
Thank you for your dedication in improving the MPF library ! π I am looking for different options for the X_AXIS/GRID adjustments:
[1] : Drawing vertical line for all panels ( when passing
**kwargs(vlines)
tompf.plot()
it is not drawing on all panels)[2] : Adjusting the
grid
forx_axis
with MPF. I seen other examples where we have to useaxes
. Is there a more efficient way to do that with MPF?If i well understood what others did is, returning the
axes
and then calling theadd_subplot
method from MPL wich will force me to start again from scratch using only MPL.I guess I missed something, here is a part of my code:
(If you prefer 2 different posts i can separate each request..)