170720 Python + Matplotlib for Boxplot(有点乱,后面有空再整理)
来源:互联网 发布:苹果园软件下载 编辑:程序博客网 时间:2024/06/07 13:40
# -*- coding: utf-8 -*-"""Created on Thu Jul 20 15:41:42 2017@author: GuokaiLiu"""import numpy as npimport matplotlib.pyplot as pltdef bp(data): f = data # Create a figure instance fig = plt.figure(1, figsize=(9, 6)) # Create an axes instance ax = fig.add_subplot(111) # Create the boxplot bp = ax.boxplot(f, patch_artist=True) ax.set_xticklabels(['DSCNN','IDSCNN']) ## add patch_artist=True option to ax.boxplot() ## to get fill color #bp = ax.boxplot(data_to_plotrue) ## change outline color, fill color and linewidth of the boxes for box in bp['boxes']: # change outline color box.set( color='#7570b3', linewidth=2) # change fill color box.set( facecolor = '#1b9e77' ) ## change color and linewidth of the whiskers for whisker in bp['whiskers']: whisker.set(color='#7570b3', linewidth=2) ## change color and linewidth of the caps for cap in bp['caps']: cap.set(color='#7570b3', linewidth=2) ## change color and linewidth of the medians for median in bp['medians']: median.set(color='#b2df8a', linewidth=2) ## change the style of fliers and their fill for flier in bp['fliers']: flier.set(marker='o', color='#e7298a', alpha=0.5) ## Custom x-axis labels #ax.set_xticklabels(['Sample1', 'Sample2', 'SampleA3', 'Sample4']) ## Remove top axes and right axes ticks ax.get_xaxis().tick_bottom() ax.get_yaxis().tick_left() plt.title('DSCNN vs IDSCNN on C→A') plt.ylim(0.8,1.005) # Save the figure fig.savefig('bp.png', bbox_inches='tight',dpi=360)bp(data_array)
阅读全文
0 0
- 170720 Python + Matplotlib for Boxplot(有点乱,后面有空再整理)
- 170720 混淆矩阵绘制+pandas读取数据(有点乱,后面抽空再整理)
- weblogic迁移至websphere的步骤和方法(简要步骤说明,随笔写的,有点乱,有空再整理一下)
- driver最近做的小笔记,有点乱,后面来整理
- 侧栏,底部导航,选项卡(未整理,有点乱)
- 无(有点乱)
- 整理笔记。记的有点乱。
- 有点乱!
- 有点乱
- 有点乱
- 有点乱~
- 有点乱
- 有点乱
- 有点乱
- 有点乱
- 有点乱
- Matplotlib for Python Developers
- 有点乱、有点烦
- AJAX——核心XMLHttpRequest对象
- 今天开通了博客很高兴!Hello csdn!
- 汇编值标识
- 在eclipse中如何使用maven项目
- 基于模板excel导出
- 170720 Python + Matplotlib for Boxplot(有点乱,后面有空再整理)
- java基础(七):程序的封装
- 大创log03(07/20)
- [ZJOI2008]骑士
- 简单的选项卡
- mv命令写错路径执行后,文件不见了~
- 1.请定义一个交通工具(Vehicle)的类其中有: 属性: 速度(speed)、 体积(size)等,方法:移动(move())、设置速度(setSpeed(int speed))、加速 spee
- logistic regression
- 常用的排序算法的时间复杂度和空间复杂度(转)