Highlight matplotlib points that go over or under a threshold in colors based on the amount the boundaries are crossed

前端 未结 2 1201
隐瞒了意图╮
隐瞒了意图╮ 2021-01-03 13:46

I have a graph that looks like this:

\"\"

And the code I\'m running to get this graph (one of a sequence of

2条回答
  •  Happy的楠姐
    2021-01-03 14:13

    Use boolean indexing to identify these points and plot them separately:

    import numpy as np
    x = np.random.rand(20)
    
    b = x > 0.7
    
    print(b)
    print(x[b])
    

提交回复
热议问题