avatar
文章
2976
标签
100
分类
63
首页
时间轴
标签
分类
知识库
关于
友链
LogoEstom的博客interp_demo 返回首页
搜索
首页
时间轴
标签
分类
知识库
关于
友链

interp_demo

发表于2020-09-26|更新于2020-09-26|Python
|总字数:75|阅读时长:1分钟|浏览量:

插补示例

插补示例图

1
2
3
4
5
6
7
8
9
10
11
12
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 2 * np.pi, 20)
y = np.sin(x)
yp = None
xi = np.linspace(x[0], x[-1], 100)
yi = np.interp(xi, x, y, yp)

fig, ax = plt.subplots()
ax.plot(x, y, 'o', xi, yi, '.')
plt.show()

下载这个示例

  • 下载python源码: interp_demo.py
  • 下载Jupyter notebook: interp_demo.ipynb
文章作者: Estom
文章链接: https://estom.github.io/2020/09/26/Python/matplotlab/gallery/lines_bars_and_markers/interp_demo/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Estom的博客!
cover of previous post
上一篇
line_demo_dash_control
自定义虚线样式通过破折号序列控制线的划线。 它可以使用Line2D.set_dashes进行修改。 破折号序列是一系列点的开/关长度,例如 [3,1]将是由1pt空间隔开的3pt长线。 像Axes.plot 这样的函数支持将Line属性作为关键字参数传递。 在这种情况下,您可以在创建线时设置划线。 注意:也可以通过property_cycle配置破折号样式,方法是使用关键字破折号将破折号序列列表传递给循环器。这个例子中没有显示。 1234567891011121314151617import numpy as npimport matplotlib.pyplot as pltx = np.linspace(0, 10, 500)y = np.sin(x)fig, ax = plt.subplots()# Using set_dashes() to modify dashing of an existing lineline1, = ax.plot(x, y, label='Using set_dashes()')line1.set_dashes([...
cover of next post
下一篇
gradient_bar
渐变条形图 1234567891011121314151617181920212223242526272829import matplotlib.pyplot as pltimport numpy as npnp.random.seed(19680801)def gbar(ax, x, y, width=0.5, bottom=0): X = [[.6, .6], [.7, .7]] for left, top in zip(x, y): right = left + width ax.imshow(X, interpolation='bicubic', cmap=plt.cm.Blues, extent=(left, right, bottom, top), alpha=1)xmin, xmax = xlim = 0, 10ymin, ymax = ylim = 0, 1fig, ax = plt.subplots()ax.set(xlim=xlim, ylim=ylim, autos...
avatar
Estom
也许那年在绿色的麦浪中奔跑的时候,就注定了我此生的繁华与悲叹
文章
2976
标签
100
分类
63
关注
公告
欢迎参观Estom的小屋
目录
  1. 1. 插补示例
    1. 1.1. 下载这个示例
最新文章
自引用泛型概述
自引用泛型概述2025-12-21
02 集合底层结构
02 集合底层结构2025-12-18
11 Arrays和Collections
11 Arrays和Collections2025-12-18
06 JUC并发容器
06 JUC并发容器2025-12-18
30 问题排查和性能优化指南
30 问题排查和性能优化指南2025-09-14
© 2025 - 2026 By Estom框架 Hexo 8.1.1|主题 Butterfly 5.5.3
搜索
数据加载中