可以选择数据的绘图上的可缩放,可拖动的框 [英] Scaleable, draggable box on plots that can select data

查看:76
本文介绍了可以选择数据的绘图上的可缩放,可拖动的框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是设置:

我有一个图形化的数据图,我试图找出尝试在图形上放置一个可以移动和改变宽度的框并返回一些值(例如下的百分比和面积)是否可行曲线.看起来像这样:

I've got a graphical plot of data, and I'm trying to find if it's feasible to try to put a box on the figure that can be moved and changed in width and return some values like percentage of and area under the curve. It looks something like this:

关于从哪里开始的任何建议?我的感觉是,使用更多的GUI界面而不是标准绘图可能是可行的.

Any suggestions on where to start? My feeling was that it might be doable using a more GUI'd interface versus a standard plot.

推荐答案

我将从imrect开始.它是可拖动的,您可以向其添加回调.

I would start with imrect. It is draggable, and you can add callbacks to it.

(直接来自MATLAB帮助)

figure, imshow('cameraman.tif');
h = imrect(gca, [10 10 100 100]);
addNewPositionCallback(h, @(p) title(mat2str(p, 3)));
fcn = makeConstrainToRectFcn('imrect', get(gca,'XLim'), get(gca, 'YLim'));
setPositionConstraintFcn(h, fcn);

addNewPositionCallback更改为适合您的需求.具体来说,从图像中获取所需的像素(通过使用位置),然后计算任意值.

Change the addNewPositionCallback to something that suits your needs. Specifically, get the needed pixels from the image (by using the position), and calculate whatever you like.

这篇关于可以选择数据的绘图上的可缩放,可拖动的框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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