专栏
标签
Syslab如何把两个图画在一起?
技术分享
发布于 2025-07-22 13:35:10
查看 1过去315天

调用 subplot 函数以创建一个 2×1 分块图布局和一个坐标区对象,并将该对象返回为 ax1。通过将 ax1 传递给 plot 函数来创建顶部绘图。通过将坐标区传递给 title 和 ylabel 函数,为图添加标题和 y 轴标签。重复该过程以创建底部绘图。

代码如下:

using TyPlot

x = LinRange(0, 3, 100);

y1 = sin.(5 * x);

y2 = sin.(15 * x);

ax1 = subplot(2, 1, 1)

ax2 = subplot(2, 1, 2)

# Top plot

plot(ax1, x, y1)

title(ax1, "Top Plot")

ylabel(ax1, "sin(5x)")

# Bottom plot

plot(ax2, x, y2)

title(ax2, "Bottom Plot")

ylabel(ax2, "sin(15x)")

image.png

所属专栏:Syslab基础平台
产品信息:Syslab科学计算环境
科学计算

全部回答

暂无数据
暂无数据
用户
和原帖交流更多问题细节吧,去
我要发帖 我要发帖
资料中心 资料中心
查看更多>
热门帖子 热门帖子
主要贡献者 主要贡献者
过去7天