Matplotlib可视化(二十三)-- 美化图形

使用python自带样式进行美化
#!usr/bin/env python
# -*- coding:utf-8 _*-
"""
@author: Caramel
@file: 2.6.py
@time: 2020/03/04
@desc:美化图形
"""

import numpy as np
import matplotlib.pyplot as plt
# plt.style.use('ggplot')
# plt.style.use('fivethirtyeight')

fig, axes = plt.subplots(ncols=2, nrows=2)
ax1, ax2, ax3, ax4 = axes.ravel()
x, y = np.random.normal(size=(2, 100))
ax1.plot(x, y, 'o')
x = np.arange(0, 10)
y = np.arange(0, 10)
ncolors = 7#颜色循环
shift = np.linspace(0, 10, ncolors)

for s in shift:
    ax2.plot(x, y+s, '-')

x = np.arange(5)
y1, y2, y3 = np.random.randint(1, 25, size=(3, 5))
width = 0.25

ax3.bar(x, y1, width)
ax3.bar(x + width, y2, width)
ax3.bar(x + 2 * width, y3, width)

for i in range(7):
    xy = np.random.normal(size=2)
    ax4.add_patch(plt.Circle(xy, 0.3))

ax4.axis('equal')
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值