-
Notifications
You must be signed in to change notification settings - Fork 657
Fill Between of Supblot #257
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
Comments
Hi @mcavas98 Thanks for your interest in mplfinance, and thanks for including your code (easier for me to answer your questions). By the way, that's a great looking plot. I really enjoy seeing the creative things people are doing with mplfinance. Now, to answer your questions: 1. Yes and no. Presently fig, axlist = mpf.plot(data,...,returnfig=True)
Choose the Axes object you want from the list and call 2. Regarding the title location, this is being pushed down into the graph because you have chosen
I hope that helps. Keep me posted. All the best. --Daniel P.S. If you have any interest in writing the code for mplfinance to support |
Thank you for your reply. Unfortunately I am very new to coding, I don't think I would be able to do it. But thank you for this great library. |
Hi @DanielGoldfarb, I have tried using the solution above to fill between two curves on an addplot. However, I cannot just call
How do you access the values of the plots on the axes to feed that to the x and y1 of the fill between function. |
Hi @luongjames8 ... sorry for any confusion; let me clarify:
Please let me know if these suggestions help. Thanks. --Daniel |
Thanks for clarifying and for the mini-tutorial on matplotlib axes. I actually had tried passing the index values directly for x -- which did not work. But after reading your comment, realise that I need to pass integers if Thanks. This worked for me. |
Hi @DanielGoldfarb , I came across this issue which helped me figure out my questions with
If I try to subplot the axes separately, everything seems to work just fine: It seems to me as if the axes objects don't share the same x axis (or at least the format doesn't seem to match). Do you happen to have an advise on that or maybe a hint on how to fix it? Thank you! |
@viorell91 Please try one of the following:
The reason is this: When Please let me know if either of the above solutions work for you. They should both work (Individually, but not together). It's just a matter of whether or not you want to see non-trading days on the x-axis. |
Worked like a charm, @DanielGoldfarb. I should have read your explanation more carefully - it makes sense now. Thanks for your work and amazing support! |
Hi I have an issue where I get fill white gaps between the lines drawn over time, can anyone please see anything wrong with below? thanks. <extra_plot = [
|
@leemidgley Probably not related: you can use figscale and figratio together, but once you use figsize then both figscale and figratio are ignored (since figsize includes both). Also, just curious, have you tried withOUT returnfig=True? Just curious to know if you get the same problem for that case. The mplfinance code path is slightly different when returnfig=True. |
Sure, I've tried without the returnfig=True - on screen has same issue. The first thing I tried was taking out all the scaling as it does look that way but still no joy!. def get_sma(prices, rate): def get_bollinger_bands(prices, rate=20):
The data is more tricky to post as it's not straight forward (taken from a live exchange binance), the thing is the bands are been generated correctly and plot correctly, it's just the fill between the bands that is the issue yet same values are been used. (weird one) example data:-
ts [240 rows x 11 columns] Process of elimination (Simplified):-
produces image:- |
you can see from below, all the data times match up:- bollinger_up |
@leemidgley The problem (or really limitation) is that, as mplfinance is currently written, By putting the Bollinger bands on the secondary Axes you actually slight shift their position. You can see this in the image here if you look at the price labels on the left of right of the plot, you can see those on the right are slightly higher. Thus your Bollinger bands are really slightly out of place (and it is actually the The reason this can happen is matplotlib uses the data being plotted to determine the min and max of each Axes. When you put the Bollinger bands on a separate Axes, then matplotlib gives them their own min/max calculation. The result is that the Bollinger bands Axes gets a slightly different min and max that that for the candles (because the values themselves are indeed slightly different). This means that if, for some reason, you wanted to keep secondary_y=True, then you could fix the problem by manually setting the min and max of the y-axis yourself. This can be done with kwarg All the best. --Daniel |
Thanks Daniel, one quick question - is it possible to show a circle with no fill. i.e. just the o outline? mpf.make_addplot(df['circle'],type='scatter',marker='o',markersize=2400 Lee. |
Ignore above, marker='$◯$' works fine for me. for anyone else I found this useful site for symbols: www.symbolcopy.com/circle-symbol.html |
Hi, I have 2 questions;
You can see my graph attached.
1)Firstly I was wondering if there was a way to use the fill between commands in subplots. For example in my RSI(third graph from top) where the data is over 70 or below 30. Also is there a way to customize the values on the y axis? For example it would be nice to add 30 and 70 to the y-axis as tickers.
2)Additionally can I move my title (it is in the middle of a graph)?
My code is below:
def plot_graph(ticker, df):
Thanks in advance for any help.
The text was updated successfully, but these errors were encountered: