如何更改Matlab图形中的行顺序? [英] How to change the order of lines in a Matlab figure?

查看:27
本文介绍了如何更改Matlab图形中的行顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定一个 .fig 文件中的三个曲线图,我想添加另一个图(使用 hold allplot),但是把它在已经存在的曲线之一后面(即确保最后一条原始曲线保持在前景曲线).是否可以在不提取绘图数据并重新绘图的情况下实现这一点?

Given a plot of three curves in a .fig file I'd like to add another plot (with hold all and plot), but put it behind one of the already existing curves (i.e. make sure the last original curve stays the foreground one). Can this be achieved without having to extract the plot data and re-plotting?

推荐答案

如果你知道你想要在顶部的线句柄(例如,因为你调用了 h = plot(...),你可以使用 uistack

If you know the handle of line you want on top (e.g. because you called h = plot(...), you can use uistack

uistack(h,'top')

或者,您可以直接操纵当前轴的子轴的顺序.下面将最后一条曲线放在最上面.

Alternatively, you can manipulate the order of children of your current axes directly. The following puts the last-most curve on top.

chH = get(gca,'Children')
set(gca,'Children',[chH(end);chH(1:end-1)])

这篇关于如何更改Matlab图形中的行顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆