matplotlib 自带的几种美化样式


1、用 matplotlib.pyplot.style.avaliable 可查看 matplotlib 自带的美化样式如下:

['bmh',            'classic',        'dark_background', 'fast',             'fivethirtyeight',   'ggplot', 'grayscale',         'seaborn-bright',    'seaborn-colorblind', 'seaborn-dark-palette',  'seaborn-dark',      'seaborn-darkgrid', 'seaborn-deep',       'seaborn-muted',     'seaborn-notebook', 'seaborn-paper',       'seaborn-pastel',    'seaborn-poster', 'seaborn-talk',       'seaborn-ticks',      'seaborn-white', 'seaborn-whitegrid',      'seaborn',            'Solarize_Light2', 'tableau-colorblind10',   '_classic_test']

2、用如下的循环,可查看各种美化样式的效果

import numpy as np import matplotlib.pyplot as plt styles = plt.style.available x = np.linspace(-10, 10) y = np.sin(x) for style in styles: plt.figure() plt.style.use(style) plt.plot(x, y) plt.title(style) plt.show()

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM