unique plot marker for each plot in matplotlib

前端 未结 5 2095
走了就别回头了
走了就别回头了 2021-01-03 18:04

I have a loop where i create some plots and I need unique marker for each plot. I think about creating function, which returns random symbol, and use it in my program in thi

5条回答
  •  清酒与你
    2021-01-03 18:28

    You can also use marker generation by tuple e.g. as

    import matplotlib.pyplot as plt
    markers = [(i,j,0) for i in range(2,10) for j in range(1, 3)]
    [plt.plot(i, 0, marker = markers[i], ms=10) for i in range(16)]
    

    See Matplotlib markers doc site for details.

    In addition, this can be combined with itertools.cycle looping mentioned above

提交回复
热议问题