matplotlib的基本用法(六)——设置坐标轴label
来源:互联网 发布:手机dota2视频软件 编辑:程序博客网 时间:2024/06/04 21:46
文章作者:Tyan
博客:noahsnail.com | CSDN | 简书
本文主要是关于matplotlib的一些基本用法。
- Demo
import matplotlib.pyplot as pltimport numpy as np# 绘制普通图像x = np.linspace(-3, 3, 50)y = 2 * x + 1plt.figure()plt.plot(x, y)# 将上、右边框去掉ax = plt.gca()ax.spines['right'].set_color('none')ax.spines['top'].set_color('none')# 设置x轴的位置及数据在坐标轴上的位置ax.xaxis.set_ticks_position('bottom')ax.spines['bottom'].set_position(('data', 0))# 设置y轴的位置及数据在坐标轴上的位置ax.yaxis.set_ticks_position('left')ax.spines['left'].set_position(('data', 0))# 设置坐标轴label的大小,背景色等信息for label in ax.get_xticklabels() + ax.get_yticklabels(): label.set_fontsize(12) label.set_bbox(dict(facecolor = 'green', edgecolor = 'None', alpha = 0.7))plt.show()
- 结果
0 0
- matplotlib的基本用法(六)——设置坐标轴label
- matplotlib的基本用法(二)——设置坐标轴
- matplotlib的基本用法(三)——调整坐标轴
- matplotlib的基本用法(十五)——主次坐标轴
- matplotlib的基本用法(四)——设置legend图例
- matplotlib设置坐标轴
- matplotlib画图坐标轴设置
- matplotlib--设置坐标轴
- Label的基本用法
- label的基本用法
- matplotlib 设置坐标轴显示内容
- matplotlib的基本用法(一)——figure的使用
- matplotlib的基本用法(五)——添加annotation
- matplotlib的基本用法(七)——绘制散点图
- matplotlib的基本用法(八)——绘制柱状图
- matplotlib的基本用法(十)——绘制Image
- matplotlib的基本用法(十六)——创建动画
- matplotlib的基本用法(十七)——保存figure
- spacemacs project设置
- Linux 打开关闭selinux方法
- js date格式化
- VMware上安装Ubuntu完整教程
- 进程管理(一)
- matplotlib的基本用法(六)——设置坐标轴label
- linx的拷贝
- java进阶--Java中comparator及comparable完全解析
- [摘抄-学习中]java-webscoekt中ngnix反向代理配置
- thinlphp--SQL连贯操作
- 每日三题-Day5-B(POJ 3186 Treats for the Cows 区间DP)
- UM三方登录报错
- 四月英语总结
- C语言NULL和0的区别详解