How to view all colormaps available in matplotlib?

前端 未结 2 772
自闭症患者
自闭症患者 2020-12-09 20:13

I was wondering if there is a function call that can give me the name of all colormaps available in matplotlib?

It used to be possible by something along the lines o

2条回答
  •  眼角桃花
    2020-12-09 20:41

    plt.colormaps() returns a list of all registered colormaps. From the docs:

    matplotlib.pyplot.colormaps()

    Matplotlib provides a number of colormaps, and others can be added using register_cmap(). This function documents the built-in colormaps, and will also return a list of all registered colormaps if called.

    The list this returns includes viridis, magma, inferno and plasma for me in 1.5.0

提交回复
热议问题