matplotlib--设置坐标轴
来源:互联网 发布:网络足球解说招聘 编辑:程序博客网 时间:2024/06/02 06:15
设置图像的
调整坐标轴位置
XY坐标轴范围及名称
import numpy as npimport matplotlib.pyplot as pltx = np.linspace(-3, 3, 50) #X axis datay1 = np.sin(x)*x**2 +1plt.figure()plt.plot(x, y1)plt.scatter(x, y1, c='r')# set colorplt.xlim((-2,2))plt.ylim((-2,5))plt.xlabel('X Axis')plt.ylabel('Y Axis')plt.savefig('d:/f.png')plt.show()
设置坐标数据
import numpy as npimport matplotlib.pyplot as pltx = np.linspace(-3, 3, 50) #X axis datay1 = np.sin(x)*x**2 +1plt.figure()plt.plot(x, y1)plt.scatter(x, y1, c='r')# set colorplt.xlim((-2,2))plt.ylim((-2,5))plt.xlabel('X Axis')plt.ylabel('Y Axis')new_ticks = np.linspace(-2,2,4)plt.xticks(new_ticks)y_ticks=[[-1, 1, 4], ['$Bad$','Normal', '$Good$']]plt.yticks(y_ticks[0], y_ticks[1])plt.savefig('d:/f.png')plt.show()
设置边框颜色
ax = plt.gca()ax.spines['right'].set_color('none')ax.spines['top'].set_color('none')ax.spines['left'].set_color('red')ax.spines['bottom'].set_color('red')
调整坐标轴位置
#xaxis.set_ticks_position设置刻度及数字名称的显示位置ax.xaxis.set_ticks_position('top')#set tick position para:top, bottom, both, default, noneax.yaxis.set_ticks_position('right')#使用spines设置边框,set_position设置边框位置ax.spines['left'].set_position(('data', 0))
阅读全文
1 0
- matplotlib设置坐标轴
- matplotlib画图坐标轴设置
- matplotlib--设置坐标轴
- matplotlib 设置坐标轴显示内容
- python matplotlib绘图设置坐标轴刻度、文本
- matplotlib模块数据可视化-设置坐标轴
- matplotlib模块数据可视化-设置次坐标轴
- matplotlib的基本用法(二)——设置坐标轴
- matplotlib的基本用法(六)——设置坐标轴label
- matplotlib命令与格式:tick坐标轴主副刻度设置
- matplotlib隐藏坐标轴
- matplotlib去掉坐标轴刻度
- matplotlib 次坐标轴
- 设置坐标轴
- matplotlib坐标轴中文乱码问题解决
- 演示MatPlotLib中如何设置坐标轴主刻度标签和次刻度标签
- 使用matplotlib绘制图像并设置标题以及坐标轴等信息
- matplotlib命令与格式:设置栅格,axes脊柱(坐标轴),背景颜色
- HTML5新增的常用元素
- poj 3169 Layout (差分约束)
- Spring常见注解及注解注入
- Python 下载网页
- 阿里巴巴涉足的领域
- matplotlib--设置坐标轴
- Java中的锁 (3) 同步器AQS (AbstractQueuedSynchronizer)
- Spark RDD API解析及实战
- 最小生成树(prime)
- shell语法整理
- LDA的使用记录--TREC,测试
- 最短路总结(迪杰斯特拉+floyed+SPFA)
- 使用配方更换型号
- 如何在ubuntu中安装中文输入法