matplotlib 自带的几种美化样式

时间:2019-12-15 22:28:18   收藏:0   阅读:322

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()

技术分享图片

技术分享图片

技术分享图片

技术分享图片

技术分享图片

技术分享图片

技术分享图片

技术分享图片

 

 技术分享图片

原文:https://www.cnblogs.com/shanger/p/12046045.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!