matplotlib的基本用法(二)——设置坐标轴
来源:互联网 发布:数据整合系统sci 编辑:程序博客网 时间:2024/06/05 09:02
文章作者:Tyan
博客:noahsnail.com | CSDN | 简书
本文主要是关于matplotlib的一些基本用法。
- Demo 1
import matplotlib.pyplot as pltimport numpy as np# 绘制普通图像x = np.linspace(-1, 1, 50)y1 = 2 * x + 1y2 = x**2plt.figure()plt.plot(x, y1)plt.plot(x, y2, color = 'red', linewidth = 1.0, linestyle = '--')# 设置坐标轴的取值范围plt.xlim((-1, 1))plt.ylim((0, 2))# 设置坐标轴的lableplt.xlabel('X axis')plt.ylabel('Y axis')# 设置x坐标轴刻度, 原来为0.25, 修改后为0.5plt.xticks(np.linspace(-1, 1, 5))# 设置y坐标轴刻度及标签, $$是设置字体plt.yticks([0, 0.5], ['$minimum$', 'normal'])plt.show()
- 结果
0 0
- matplotlib的基本用法(二)——设置坐标轴
- matplotlib的基本用法(六)——设置坐标轴label
- matplotlib的基本用法(三)——调整坐标轴
- matplotlib的基本用法(十五)——主次坐标轴
- matplotlib的基本用法(四)——设置legend图例
- matplotlib设置坐标轴
- matplotlib画图坐标轴设置
- matplotlib--设置坐标轴
- matplotlib 设置坐标轴显示内容
- matplotlib的基本用法(一)——figure的使用
- matplotlib的基本用法(五)——添加annotation
- matplotlib的基本用法(七)——绘制散点图
- matplotlib的基本用法(八)——绘制柱状图
- matplotlib的基本用法(十)——绘制Image
- matplotlib的基本用法(十六)——创建动画
- matplotlib的基本用法(十七)——保存figure
- python matplotlib绘图设置坐标轴刻度、文本
- matplotlib模块数据可视化-设置坐标轴
- 随机闹钟
- 今天第一天开博客
- Vijos 1484题:ISBN号码
- git连接GitHub
- encodeURIComponent传入后台解码
- matplotlib的基本用法(二)——设置坐标轴
- 走技术线,还是技术管理线?
- java.net.SocketException四大异常解决方案
- JVM调优
- 介绍 JSON
- Power Calculus UVA
- ThreadPoolExecutor中BlockingQueue的三种实现及排队策略
- 将list遍历出来全部删除的两种方法
- 数据库的4个概念