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()
非学无以广才,非志无以成学。