How to pick a new color for each plotted line within a figure in matplotlib?

前端 未结 7 671
日久生厌
日久生厌 2020-11-27 11:06

I\'d like to NOT specify a color for each plotted line, and have each line get a distinct color. But if I run:

from matplotlib import pyplot as plt
for i in          


        
相关标签:
7条回答
  • 2020-11-27 11:51

    You can also change the default color cycle in your matplotlibrc file. If you don't know where that file is, do the following in python:

    import matplotlib
    matplotlib.matplotlib_fname()
    

    This will show you the path to your currently used matplotlibrc file. In that file you will find amongst many other settings also the one for axes.color.cycle. Just put in your desired sequence of colors and you will find it in every plot you make. Note that you can also use all valid html color names in matplotlib.

    0 讨论(0)
提交回复
热议问题