'mplfinance - how to display numbers on top of each candle stick
How can I display letters or numbers on each candle stick on mplfinance? For example, I want to show 0 (for green bars) and 1 (for red bars) on top of each candle stick, instead of marks.
Solution 1:[1]
There are a number of ways to do this. You can do it with Axes.text() or with Axes.annotate() as noted in these examples:
- https://stackoverflow.com/a/70342687/1639359
- https://github.com/matplotlib/mplfinance/issues/387#issuecomment-828135146
However, probably the easiest solution is to use mpf.make_addplot() to create a type=scatter plot where you want the numbers to appear, and then pass in a sequence of markers for the marker= kwarg (of make_addplot), and use Mathtext markers for the markers (for example "$1$" is a '1', etc.)
Click here for example code.
Other discussions that may be worth reading through:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Daniel Goldfarb |
