Get matplotlib color cycle state

后端 未结 9 1579
慢半拍i
慢半拍i 2020-11-27 10:36

Is it possible to query the current state of the matplotlib color cycle? In other words is there a function get_cycle_state that will behave in the following wa

9条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 11:06

    In matplotlib version 2.2.3 there is a get_next_color() method on the _get_lines property:

    import from matplotlib import pyplot as plt
    fig, ax = plt.subplots()
    next_color = ax._get_lines.get_next_color()
    

    get_next_color() returns an html color string, and advances the color cycle iterator.

提交回复
热议问题