Matplotlib Tutorial 17 – annotations and placing text




[ad_1]

In this tutorial, we’re going to be talking about how we add text to Matplotlib graphs. We can do this in two ways. One is to just place text to a location on the graph. Another is to specifically annotate a plot on the chart to draw attention to it.

sample code: http://pythonprogramming.net
http://hkinsley.com
https://twitter.com/sentdex
http://sentdex.com
http://seaofbtc.com

Source


[ad_2]

Comment List

  • sentdex
    December 5, 2020

    Thank you friend! I enjoy seeing code examples done by you.

  • sentdex
    December 5, 2020

    This code for placing text is too specific for this problem. But thanks for the initiative.

  • sentdex
    December 5, 2020

    Hi, I am pulling data from an API and trying to animate a live graph like in video 16 of your tutorial. So I am getting the data within the animate function then save the results in a dictionary that I then plot just like in the tutorial. However it only generate a graph once without animating it, thus refreshing it with the data from the API. I'm trying to make a depth chart by using a stack plot chart and rounding up the book to make it look good. Any ideas on how I can make this work? Thanks a lot for your work, it is really appreciated.

  • sentdex
    December 5, 2020

    thank you!

  • sentdex
    December 5, 2020

    lov your tutorials…thank you very much…

  • sentdex
    December 5, 2020

    I get an error " TypeError: __init__() got multiple values for argument 'xytext' " when I run this code any ideas why?

  • sentdex
    December 5, 2020

    Specifying (x,y) coordinates (date[10],closep[5]) does not work for me? What to do?

    What I did is (dt.datetime(2017,9,19),217) seeing the values from plot. Then it worked.

  • sentdex
    December 5, 2020

    Hi I am making a trading bot. How would I place the buys and sell on the chart please?

  • sentdex
    December 5, 2020

    Could you please do mouseover annotations?

  • sentdex
    December 5, 2020

    This is bad way of using arrowprops
    arrowprops=dict(facecolor='red', color='grey')
    because facecolor is first set to read and after that color of all parts of arrow, facecolor included, is set to 'grey'. This is why Python sends warning.
    I use line
    arrowprops=dict(color='grey')
    and it works fine, like in the video.

  • sentdex
    December 5, 2020

    Again, this my by wrongheaded hairsplitting. I think this video title should be "Matplotlib Tutorial 17 – Annotations and placing text".

  • sentdex
    December 5, 2020

    I copied the code from the link provided but I get "" ImportError: cannot import name 'Line2D' "". How can I fixt this problem?

  • sentdex
    December 5, 2020

    You saved my day! Your coffee is on me if we ever met!

  • sentdex
    December 5, 2020

    HI this tutorial isn't work because yahoo finance API problem. how can I fix this and also how can I change google finance instead yahoo finance

  • sentdex
    December 5, 2020

    Hey Harrison,
    I have a question. I have two lists.
    names = [PG, PG-13, R, NC, G]
    ratings = [125, 256, 547, 311, 478]
    I need a plot where x axis has the names and y axis the count of these ratings.
    Help will be appreciated thanks!

  • sentdex
    December 5, 2020

    Have been looking for solutions to annotating with arrows, and this is exactly what I need. Your tutorials are well-organized and readable, and I binge-watched your other matplotlib tutorials in one sitting. Yeah, they are THAT good.

  • sentdex
    December 5, 2020

    I like how you arrange your tutorials into easily digestible bite size chunks. Good job mate.

  • sentdex
    December 5, 2020

    I love your tutorials dude. +1 sub!!!

  • sentdex
    December 5, 2020

    Very easy to understand your great content!

Write a comment