mplfinance icon indicating copy to clipboard operation
mplfinance copied to clipboard

Ability to label prices

Open Chadonillo opened this issue 5 years ago • 4 comments

This is just an idea of a little addition that I think can be useful. It would be nice to see what is the lastest value on the volume chart, price chart and also any addplots. Example:

  • The arrows have their value as a label

  • Both charts have a white box that indicates the latest price value

show

Chadonillo avatar Apr 04 '20 22:04 Chadonillo

Duplicate of https://github.com/matplotlib/mplfinance/issues/58

DanielGoldfarb avatar Apr 07 '20 15:04 DanielGoldfarb

@Chadonillo Brandon, It's been a while. I am reviewing older issues with the intent to prioritize the next set of enhancments for mplfinance. Please let me know if you are still interested in this. If so, may I ask where you got the animated plot that you have posted above, and if the code for generating that plot is available to review? Thank you. --Daniel

DanielGoldfarb avatar Dec 17 '21 18:12 DanielGoldfarb

I got close by doing the following:

    y_min, y_max = ax1.get_ylim()

    #annotate
    if yest_close > last_close:
        ax1.annotate(str(round(last_close,2)), xycoords='axes fraction',  xy=(1.02, (last_close - y_min)/(y_max - y_min) ),  size=8, 
                   bbox=dict(boxstyle="larrow",pad=0.3, fc='red', ec='red'))
    else:
        ax1.annotate(str(round(last_close,2)), xycoords='axes fraction',  xy=(1.02, (last_close - y_min)/(y_max - y_min) ),  size=8,
                   bbox=dict(boxstyle="larrow",pad=0.3, fc='green', ec='green'))

It took a bit of wrangling to get the arrow in the correct location, but this is close enough for me.

stevenm100 avatar Jun 10 '22 18:06 stevenm100

@stevenm100 Thank you for sharing your code!

DanielGoldfarb avatar Jun 10 '22 20:06 DanielGoldfarb