Advertisement

使用Python制作彩虹色饼图

阅读量:
复制代码
    from matplotlib import font_manager as fm
    from matplotlib import cm
    import matplotlib.pyplot as plt
    import pandas as pd
    import numpy as np
    
    shapes = ['Cross', 'Cone', 'Egg', 'Teardrop', 'Chevron', 'Diamond', 'Cylinder', 
          'Rectangle', 'Flash', 'Cigar', 'Changing', 'Formation']
    values = [287,   383,   842,   866,  1187,  1405,  1495,  1620,  1717, 2313,  2378,  3070]
    
    s = pd.Series(values, index=shapes)
    labels = s.index
    sizes = s.values
    # explode = (0.2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)  # only "explode" the 1st slice
    

全部评论 (0)

还没有任何评论哟~