matplotlib的基本用法(十五)——主次坐标轴
来源:互联网 发布:21端口是tcp 编辑:程序博客网 时间:2024/05/24 05:26
文章作者:Tyan
博客:noahsnail.com | CSDN | 简书
本文主要介绍matplotlib的一些用法。
- Demo
import numpy as npimport matplotlib.pyplot as plt# 定义数据x = np.arange(0, 10, 0.1)y1 = 0.05 * x ** 2y2 = -1 * y1# 定义figurefig, ax1 = plt.subplots()# 得到ax1的对称轴ax2ax2 = ax1.twinx()# 绘制图像ax1.plot(x, y1, 'g-')ax2.plot(x, y2, 'b--')# 设置labelax1.set_xlabel('X data')ax1.set_xlabel('Y1', color = 'g')ax2.set_xlabel('Y2', color = 'b')plt.show()
- 结果
0 0
- matplotlib的基本用法(十五)——主次坐标轴
- matplotlib的基本用法(二)——设置坐标轴
- matplotlib的基本用法(三)——调整坐标轴
- matplotlib的基本用法(六)——设置坐标轴label
- matplotlib的基本用法(一)——figure的使用
- matplotlib的基本用法(四)——设置legend图例
- matplotlib的基本用法(五)——添加annotation
- matplotlib的基本用法(七)——绘制散点图
- matplotlib的基本用法(八)——绘制柱状图
- matplotlib的基本用法(十)——绘制Image
- matplotlib的基本用法(十六)——创建动画
- matplotlib的基本用法(十七)——保存figure
- matplotlib 可视化 —— 移动坐标轴(中心位置)
- matplotlib的基本用法(十四)——figure图的嵌套
- matplotlib的基本用法(九)——绘制等高线图
- matplotlib的基本用法(十一)——绘制3D图
- matplotlib的基本用法(十二)——subplot绘制多图
- matplotlib的基本用法(十三)——figure绘制多图
- dao模式总结
- 设计模式之---访问者模式
- 关于llvm kaleidoscope: 记一次Debug血泪之路
- Java之反射
- idea中修改某个jsp文件的编码方式
- matplotlib的基本用法(十五)——主次坐标轴
- Java8新特性之Lambda表达式(2)
- 关于购物的简单安卓应用
- 持久化
- Java中的接口和抽象类的区别联系
- opencv3:AttributeError: 'module' object has no attribute 'CV_LOAD_IMAGE_COLOR'
- CCF NOI1170 质因数分解
- 暗网购物指南
- linux常用命令及总结