Open anhiliate opened 3 years ago
@anhiliate just curious to know why you closed this? Did you figure out a way to do it? (If so, why not post your solution here for others).
i was just thinking this might be a nice additional to the new mplfinance as kwarg type='HLC'
.
Hi Daniel,
thank you for the prompt response and for taking care of this awesome project. I was just impatient and since I'm a python noob, I ended up being satisfied with the new mplfinance in standard mode, which does a very fine job already. The only missing thing for me were only:
You definitely have my vote for kwarg type='HLC'. Please let me know if the ticket should be reopened.
Thanks.
Regarding gridspec, there is a workaround, but no direct method.
Have you read through this tutorial on creating subplot panels? Please do, and let me know if it suits your needs. If after working through that tutorial you still feel you need gridspec please explain why so that I can understand what's missing from the package.
Regarding the date format, we did get a similar request here; and I am considering whether to implement it. In the meantime you do have some control over the date format as demonstrated in cell In [8]
of the customizations tutorial.
Thank you Daniel, I went through the tutorial on creating subplot panels but I'm still stuck on one specific use case. And that is to split the last panel into 3 columns to display charts + return for alternative investments like Gold or EU or Chinese market. With that, all panels until then will share the xaxis while the last one will have 3. In general, I think that the option to split one specific panel into 2-3-4 columns would be really powerful (unless nobody else is messy like me and want to have everything compressed into one plot). Regarding the thread of the IBD chart, I'm really impressed by the result, which led me to try to achieve the following format on the weekly chart. Well, if anyone has a code snippet for this date format, I would really be thankful :)
Thanks @anhiliate ... Can you provide and image similar to your the case (where the last panel is split into three columns) you want to acheive?
Hi Daniel,
of course, this is what I had in mind: And in case you allow me to be a bit choosy, I find this syntax the most readable and less error prone to get the result above, it does not allow heigh customizations like gridspec though.
import matplotlib.pyplot as plt
fig = plt.figure()
ax1 = plt.subplot2grid((6,3), (0,0), rowspan=2, colspan=3)
ax2 = plt.subplot2grid((6,3), (2,0), colspan=3)
ax3 = plt.subplot2grid((6,3), (3,0), colspan=3)
ax4 = plt.subplot2grid((6,3), (4,0), colspan=3)
ax5 = plt.subplot2grid((6,3), (5,0))
ax5 = plt.subplot2grid((6,3), (5,1))
ax5 = plt.subplot2grid((6,3), (5,2))
plt.show()
Thanks. For now, the workaround would be to use external axes mode.
Although subplot2grid is not directly supported (but can be used) I would recommend instead using add_axes()
as described in this answer here.
Thanks Daniel,
good point, I'll try that out and update the result when I have something usable.
Sorry, it was a busy week so I only got a bit of time to play with it today. In case someone is interested, you can easily use the external axes like Daniel has proposed to get the layout I mentioned above. Below is the code to demonstrate it, with emphasis on easy maintenance and simple adjustment on layout changes: ` fig = mpf.figure()
widths = [3, 3, 3] heights = [3, 5, 2, 3, 3]
spec = gridspec.GridSpec(ncols=3, nrows=5, width_ratios=widths, height_ratios=heights) ax1 = fig.add_subplot(spec[0, :]) ax1.annotate("AX1", (0.1, 0.5), xycoords='axes fraction', va='center') ax2 = fig.add_subplot(spec[1, :]) ax2.annotate("AX2", (0.1, 0.5), xycoords='axes fraction', va='center') ax2 = fig.add_subplot(spec[2, :]) ax2.annotate("AX3", (0.1, 0.5), xycoords='axes fraction', va='center') ax2 = fig.add_subplot(spec[3, :]) ax2.annotate("AX4", (0.1, 0.5), xycoords='axes fraction', va='center') ax4 = fig.add_subplot(spec[4,0: -2]) ax4.annotate("AX5", (0.1, 0.5), xycoords='axes fraction', va='center') ax5 = fig.add_subplot(spec[4,1: -1]) ax5.annotate("AX6", (0.1, 0.5), xycoords='axes fraction', va='center') ax5 = fig.add_subplot(spec[4,2:]) ax5.annotate("AX7", (0.1, 0.5), xycoords='axes fraction', va='center')
plt.show() `
Hi everyone, I am using the original flavor of mplfinance and I am really struggling creating a simple HLC bar chart as below. Does someone have an idea how this could be achieved?
When I fill the Open column with Close data, I will get the chart but lose the coloring. I hope I don't have to split up the date based on Open< Close and Open>Close and then draw 2 candlesticks, do I? Thank you all in advance for the help.