matplotlib - black & white colormap (with dashes, dots etc)

前端 未结 4 1857
孤独总比滥情好
孤独总比滥情好 2020-12-02 07:31

I am using matplotlib to create 2d line-plots. For the purposes of publication, I would like to have those plots in black and white (not grayscale), and I a

4条回答
  •  借酒劲吻你
    2020-12-02 08:18

    I heavily did use Yann's code, but today I read an answer from Can i cycle through line styles in matplotlib So now I will make my BW plots in this way:

    import pylab as plt
    from itertools import cycle
    lines = ["k-","k--","k-.","k:"]
    linecycler = cycle(lines)
    plt.figure()
    for i in range(4):
        x = range(i,i+10)
        plt.plot(range(10),x,next(linecycler))
    plt.show()
    

提交回复
热议问题