Skip to content

Tooltip feature in mplfinance #287

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

Open
Codec580 opened this issue Nov 2, 2020 · 3 comments
Open

Tooltip feature in mplfinance #287

Codec580 opened this issue Nov 2, 2020 · 3 comments
Labels
question Further information is requested

Comments

@Codec580
Copy link

Codec580 commented Nov 2, 2020

How can I add tooltip feature in mplfinance candlestick plot?
I have provided the drive link that contains code and output.
https://drive.google.com/file/d/1y6EX2dIYiLsn4nByG7vuXbmK6yWyyYWC/view

@Codec580 Codec580 added the question Further information is requested label Nov 2, 2020
@DanielGoldfarb
Copy link
Collaborator

Tooltips are not directly supported in mplfinance, however this should be possible by setting returnfig=True when calling mpf.plot() to gain access to the Figure and Axes objects, and then using matplotlib to set up the annotations.

For some examples see:

If you get it working I would like to see the code.
I would like to incorporate this feature into mplfinance to make it easy for users to do.

All the best. --Daniel

@sarangab
Copy link

sarangab commented Nov 2, 2020

Is it possible to integrate libraries such as MPLD for tooltip?
https://mpld3.github.io/examples/scatter_tooltip.html

I think tooltips, rangesliders should be good features to add. In Plotly, we can add rangesliders to candlestick chart and have tooltips as well, but indicator plotting for example is very difficult.

@DanielGoldfarb
Copy link
Collaborator

@sarangab

Thank you for contributing to the disussion. I was looking at that exact page earlier today. Of course, anything can be integrated. However as a general rule I am reluctant to add depednecies to mplfinance. (Also, while I have never used mpld3, if my understanding is correct it works specifically with browser and notebook matplotlib backend interfaces, but not with other matplotlib backend interfaces such as X-windows; but correct me if I am wrong. If I'm correct about that, then I would be even more reluctant to add such a dependency since it would be useful only in certain environments.) All this is not etched in stone, just my strong inclination, from which I could be persuaded, if given a compeling argument for adding dependencies.

In general, I would be more inclined to provide an interface that makes it easier for the two libraries to work together.

Presently you should be able to user matplotlib's annotations and hover event feature, or a third party library such as mpld3, by gaining access to mplfinance's Figure and Axes objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants