jupyter中如何看plt.plot的局部细节

在Jupyter中使用matplotlib时,如果你想要放大图表的某一部分,可以使用matplotlib的交互式方式查看局部细节。

python 复制代码
%matplotlib notebook  # 在Jupyter中使用交互式后端
import matplotlib.pyplot as plt
import numpy as np
 
# 生成数据
x = np.linspace(0, 10, 1000)
y = np.sin(x)
 
# 绘制图形
plt.plot(x, y)

上述代码中,%matplotlib notebook魔法命令使得Jupyter使用的是兼容notebook的交互式matplotlib后端。显示图表后,你可以使用鼠标滚轮进行缩放。

相关推荐
sphw4 天前
nixnb: Jupyter Notebook 优雅分享
ide·人工智能·jupyter
编程阿峰5 天前
Python 环境配置(二)安装jupyter、matplotlib、numpy库
开发语言·python·jupyter·numpy·matplotlib
魔尔助理顾问6 天前
安装 Jupyter Notebook (推荐给 venv 用户)
开发语言·ide·python·jupyter
xuhe28 天前
一劳永逸!解决 AutoDL 系统盘(30GB)爆满与 pip 缓存迁移
linux·python·ai·jupyter
Y3815326629 天前
serpbase + Pandas + Jupyter 数据分析实战
jupyter·数据分析·pandas
栈溢出了14 天前
Jupyter 添加虚拟环境 Kernel 笔记
ide·笔记·jupyter
xing-xing16 天前
魔搭社区(ModelScope)下载模型文件
python·jupyter·llm
yang_coder1 个月前
juypter notebook启动ssl报错的处理记录
python·jupyter
菜板春2 个月前
jupyter入门-手册-特征探索
python·jupyter
程序媛kelly2 个月前
如何打开 .md / .ipynb 文件?Markdown 与 Jupyter Notebook 本地预览全攻略
ide·python·jupyter