Display Info When You Hover To A Data Point In Matplotlib (Source Code In Description)
ฝัง
- เผยแพร่เมื่อ 28 ต.ค. 2024
- This is one of the most requested topics so I thought I would finally make a video showing how to implement the feature when you hover your mouse on top of a data point a data label will automatically pop up.
📑 Source Code: wp.me/payCAw-1jR
► Buy Me a Coffee? Your support is much appreciated!
-------------------------------------------------------------------------------------------
☕ Paypal: www.paypal.me/...
☕ Venmo: @Jie-Jenn
💸 Join Robinhood with my link and we'll both get a free stock: bit.ly/3iWr7LC
► Support my channel so I can continue making free contents
---------------------------------------------------------------------------------------------------------------
🌳 Becoming a Patreon supporter: / jiejenn
🛒 By shopping on Amazon → amzn.to/2JkGeMD
📘 Facebook Page → / madeinpython
📘 More tutorial videos on my website → LearnDataAnaly...
👩💻 Follow me on Linked: / jiejenn
✉️ Business Inquiring: TH-cam@LearnDataAnalysis.org
#matplotlib #datavisualization #python
There is one problem: The hover-event shows the x-value twice. It shows (x, x) and not (x, y). It has to be like this:
text_label = '({0:.2f}, {1:.2f})'.format(data_point_location[0], data_point_location[1])
I didn't notice that. Good call!
it still ends up showing (x,x)?
Do you think is possible to do so with a simple graph and not with a scatter plot ?
Definitely. You can do it with any type of graphs.
hi, thanks for your video.
how can i apply this code at 3D scatter plot?
i tried it but ....
i made scatter like this " scatter(x,y,z) " and ran " scatter.get_offsets() ".
result was different that i think
how can i get (x,y,z) data?
I don't have much experience working with 3d graphs, I would suggest you post your question on Stack Overflow.
Hi, I tried rer-running the code, it is throwing this error:
Traceback (most recent call last):
File "./prog.py", line 23, in
TypeError: annotate() missing 1 required positional argument: 's'
Annotate function is missing a parameter value.
@@jiejenn how do i solve this. It is not showing any error when you did yours. Thanks
I charge a $7 fee for troubleshooting. Let me know if you still need my assistance.
@@jiejenn for the code you wrote or the one I am trying to make work , using your approach. Just need clarification on what I will be getting
@@taiwoosunrinde3927 it is almost impossible to troubleshoot by looking at an error description without knowing what the code looks like. That's what I'm trying to say.
Why not using plotly? They do it by default
I prefer matplotlib.
I'm unable to do this in google colab the hover doesn't appear in it
Did you get the solution for this??? I have been stuck at the same problem too. 🥲🥲
Can you make video on how to delete ALL videos on a TH-cam channel using YT API?
I will look into it.
Very good thx.