Comments (8)
I suggest, do not do subplots. Do only panels.
Officially there can only be one "main" plot. However you can make a "second" main plot by passing type='candle'
to one of your make_addplot()
calls.
from mplfinance.
I suggest, do not do subplots. Do only panels.
Officially there can only be one "main" plot. However you can make a "second" main plot by passing
type='candle'
to one of yourmake_addplot()
calls.
But if only one main plot with three panel, that will make all three panel share x-axis whith main plot. And that's not I want.
I want to show a plot with it's panel and other plot with it's panel, they are daily klines and 60min klines, and they have different x-axis.
I found a way to do that what generate two image and merge together, but I think it's not a best way(or offical way) to do that. And it is not any clue in offical document told me that couldn't put subplot and panel together.
from mplfinance.
I found a way to do similar thing in following code:
fig = mpf.figure(figsize=(8,6))
ax1 = fig.add_subplot(2,2,1)
ax2 = fig.add_subplot(2,2,2)
av1 = fig.add_subplot(2,2,3)
av2 = fig.add_subplot(2,2,4)
mpf.plot(df1,type='candle',ax=ax1, mav=(5),axtitle='stock1')
mpf.plot(df2,type='candle',ax=ax2, mav=(5),axtitle='stock2')
av1.plot(df1.index,df1['rsi6'])
av2.plot(df2.index,df2['rsi6'])
mpf.show()
It's make a 2x2 subplots, use mpf draw candlestick, use matplotlib.pyplot to draw rsi6.
But there is some problem like: ax1 and av1 couldn't share x-axis, the result seems amateurish, etc.
This is not a satisfactory solution.
from mplfinance.
The number of panels is entirely up to you ... you decide and code it accordingly.
Take a look, for example, at cell In [24]
near the bottom of https://github.com/matplotlib/mplfinance/blob/master/examples/addplot.ipynb
from mplfinance.
The number of panels is entirely up to you ... you decide and code it accordingly.
Take a look, for example, at cell
In [24]
near the bottom of https://github.com/matplotlib/mplfinance/blob/master/examples/addplot.ipynb
Thanks for your reply. I try to check the code you said. Yes, it can set serval panel in a plot, but they will share same x-axis. That's not the situation what I said.
I want the result is: create a one column four row plot. the first row is candlestick 1(which is daily k-lines), the second row is rsi6 for the first row, they will share x-axis. And the third row is candlestick 2(which is 60min k-lines, so it's will use a different x-axis), the fourth row is rsi6 for the third row, the third and fourth row will share x-axis.
from mplfinance.
I'm sorry, I didn't read carefully enough. I didn't realize you wanted two different x-axes. Yes, the way mplfinance is written, panels will always share x-axes, so you will have to use external axes mode. I will go back and read more carefully and see if I can find a better solution for you.
from mplfinance.
I'm sorry, I didn't read carefully enough. I didn't realize you wanted two different x-axes. Yes, the way mplfinance is written, panels will always share x-axes, so you will have to use external axes mode. I will go back and read more carefully and see if I can find a better solution for you.
Thank you very much.
I tried lots of solution but all failed. It seems your solution posted at other issue what generate two image and merge together is the only way to do that.(#318 (comment))
from mplfinance.
It seems to generate two image of candlestick and combine to one in fig is the only way to solve it. But it's clearly it will bring some shortcomings(for example it's hard to add mouse cross because it's not a candlestick but a image).
I will close this issue, thanks @DanielGoldfarb
from mplfinance.
Related Issues (20)
- Minor enhancements on some simple plot handling HOT 2
- Feature Request: Alternating Background Color
- during save to image file to the disk, there are some noise...how to fix these issue? HOT 2
- Adding ConciseDateFormatter displays dates from 1970 HOT 10
- Bug Report: Is there a typo in src/mplfinance/plotting.py, line 946: fig.suptitle(title,**title_kwargs) HOT 1
- how to get OHLC return values and trend from renko plot HOT 1
- Issue while trying to get_ydata of an EMA from a fig or from the axes HOT 3
- Feature Request: HOT 2
- How do i get renko values without ploting the chart? HOT 2
- weird orange line appearing in axes' .plot() HOT 1
- Parabolic Sar and supertrend for renko
- Assist to draw Simple Moving Average. HOT 2
- I just don't know who to ask…. HOT 1
- mplfinance warn if user passes an empty data set. HOT 1
- Feature Request: The line width argument adding request for 'candlestick_ohlc' about the 'Wick/shadow' part(above/blow line) HOT 9
- Bug Report: marketcolors display error when open=close HOT 1
- Bug Report: Typo HOT 1
- How do I create a buy indicator using mplfinance? HOT 1
- Using with `matplotlib.testing.decorators.image_comparison` HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mplfinance.