当前位置:网站首页>matplotlib绘制直线图
matplotlib绘制直线图
2022-07-21 10:12:00 【学习中~~~】
import numpy as np
import matplotlib.pyplot as plt
# 1.用arrange函数构造点,以此形成直线图
x1 = np.arange(1, 10) # arange函数默认间隔为1,所以x从1一直到9,共9个数字
y1 = np.arange(2, 11) # y也必须是9个数字,才能与x组成9个点
# plt.ylim(0, 11) # 设置y轴的区间范围
# plt.plot(x1, y1)
# plt.show()
# 2.使用array,生成具体点
x = np.array([1, 2, 3])
y = np.array([0, 3, 4]) # 注意:y要与x一一对应。图中点为(1,0),(2,3),(3,4)
plt.plot(x, y, x1, y1) # plot函数可以输入多个参数,但要一一对应
plt.show()
边栏推荐
- ASUS Adu 14 Pro is equipped with the new generation 12 core standard voltage processor
- Quartz simple usage and its es job
- OpenCV:如何去除票据上的印章
- 871. 约数之和
- Codeforces Round #580 (Div. 2) C- Almost Equal【规律】
- Six ways for JS to implement inheritance
- 我,AI博士生,在线众筹研究主题
- 调用百度AI开放平台实现图片文字识别
- 树莓派3B搭建Flink集群
- 代码表征预训练语言模型学习指南:原理、分析和代码
猜你喜欢
ASUS Adu 14 Pro is equipped with the new generation 12 core standard voltage processor
Layer 3 switching and VRRP
Un7.20: how to display two attributes in an association table at the same time?
代码表征预训练语言模型学习指南:原理、分析和代码
[sklearn] data set split sklearn moduel_ selection. train_ test_ split
ATL容器——CAtlMap,CRBMap
A Beginner guide to Deep Learning based Semantic Segmentation using Keras
Why can redis single thread be so fast
I, AI doctoral student, online crowdfunding research topic
Switch DHCP server configuration method (command line version)
随机推荐
from scratch implement crnn using pytorch :读取训练数据
Codeforces Round #578 (Div. 2) B - Block Adventure 【贪心】
[watermelon book learning] 1. Decision tree
显示一个圆,并可以移动
MySQL性能优化(三):深入理解索引的这点事
Codeforces Round #580 (Div. 2) C- Almost Equal【规律】
Nature | 杨祎等揭示宿主内进化或可导致肠道共生菌致病
VC字符串与时间戳相互转换
Leetcode 111. Minimum depth of binary tree
驱动开发之双机调试环境搭建(VS2017)
Airbnb 如何实现 Kubernetes 集群动态扩展
个性潮流与性能兼备,华硕a豆14 Pro搭载全新12代酷睿标压处理器
IP subnet Division
本机电脑清除DNS缓存+浏览器清除DNS缓存
Recommendation number | those who are truly outstanding are practicing the "best strategy in life" and recommending these high-quality numbers
Alberl duilib入门及进阶教程
SVD singular value decomposition matrix compression
手把手教您上传NCBI 数据,免费课程包您学会!
上海地铁9号线有人持刀砍人?轨交公安:是安全演练
rust 文件读写操作