Adding an arbitrary line to a matplotlib plot in ipython notebook

后端 未结 5 1352
孤独总比滥情好
孤独总比滥情好 2020-12-07 14:41

I\'m rather new to both python/matplotlib and using it through the ipython notebook. I\'m trying to add some annotation lines to an existing graph and I can\'t figure out ho

5条回答
  •  佛祖请我去吃肉
    2020-12-07 14:47

    Using vlines:

    import numpy as np
    np.random.seed(5)
    x = arange(1, 101)
    y = 20 + 3 * x + np.random.normal(0, 60, 100)
    p =  plot(x, y, "o")
    vlines(70,100,250)
    

    The basic call signatures are:

    vlines(x, ymin, ymax)
    hlines(y, xmin, xmax)
    

提交回复
热议问题