【再回首Python之美】【Matplotlib】一网打尽matplotlib示例

前提说明

颜色值

设置图形的颜色时,有以下颜色值可以选择:

字符	颜色
'b'		蓝色blue

'g'		绿色green

'r'		红色red

'c'		青色cyan

'm'		品红magenta

'y'		黄色yellow

'k'		黑色black

'w'		白色white

形状值

字符	描述

'-'	实线

'--'	虚线

'-.'	点线

':'	点虚线

'.'	点

','	像素

'o'	圆形

'v'	朝下的三角形

'^'	朝上的三角形

'<'	朝左的三角形

'>'	朝右的三角形

'1'	tri_down marker

'2'	tri_up marker

'3'	tri_left marker

'4'	tri_right marker

's'	正方形

'p'	五角形

'*'	星型

'h'	1号六角形

'H'	2号六角形

'+'	+号标记

'x'	x号标记

'D'	钻石形

'd'	小版钻石形

'|'	垂直线形

'_'	水平线行

1.一个图像多个子图像

1.1 一排子图像subplot

# -*- coding: utf-8 -*-
"""

@author: 蔚蓝的天空TOM
Talk is cheap, show me the code

"""

import matplotlib.pyplot as plt
    
#左边一个subfigure,右边一个subfigure
def tom_subplot_row():
    plt.figure(1)
    plt.subplot(121, axisbg=(.9, .9, .5))#left subfigure
    plt.title("subplot(121)")
    plt.subplot(122, axisbg=(.9, .9, .9))#right subfigure
    plt.title("subplot(122)")
    plt.show()
    
if __name__=="__main__":
    tom_subplot_row()


1.2一列子图像subplot

# -*- coding: utf-8 -*-
"""

@author: 蔚蓝的天空TOM
Talk is cheap, show me the code

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值