Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
is there any function to plot draggable points on plots?

Subject: is there any function to plot draggable points on plots?

From: Ha

Date: 16 Nov, 2012 19:12:18

Message: 1 of 7


ginput can plot points interactively but the points are not draggable.

Subject: is there any function to plot draggable points on plots?

From: matt dash

Date: 16 Nov, 2012 20:21:11

Message: 2 of 7

"Ha" wrote in message <k8636h$8ph$1@newscl01ah.mathworks.com>...
>
> ginput can plot points interactively but the points are not draggable.

No, you have to code that yourself using a series of functions. Here is a simple example:

function dragtest
figure
axes('xlimmode','manual','ylimmode','manual') %<- important
line(0.5,0.5,'marker','s','markersize',10,'hittest','on','buttondownfcn',@clickmarker)

function clickmarker(src,ev)
set(ancestor(src,'figure'),'windowbuttonmotionfcn',{@dragmarker,src})
set(ancestor(src,'figure'),'windowbuttonupfcn',@stopdragging)

function dragmarker(fig,ev,src)
coords=get(gca,'currentpoint');
x=coords(1,1,1);
y=coords(1,2,1);
set(src,'xdata',x,'ydata',y);

function stopdragging(fig,ev)
set(fig,'windowbuttonmotionfcn','')
set(fig,'windowbuttonupfcn','')

Subject: is there any function to plot draggable points on plots?

From: Nasser M. Abbasi

Date: 16 Nov, 2012 21:28:42

Message: 3 of 7

On 11/16/2012 2:21 PM, matt dash wrote:
> "Ha" wrote in message <k8636h$8ph$1@newscl01ah.mathworks.com>...
>>
>> ginput can plot points interactively but the points are not draggable.
>
> No, you have to code that yourself using a series of functions. Here is a simple example:
>
> function dragtest
> figure
> axes('xlimmode','manual','ylimmode','manual') %<- important
> line(0.5,0.5,'marker','s','markersize',10,'hittest','on','buttondownfcn',@clickmarker)
>
> function clickmarker(src,ev)
> set(ancestor(src,'figure'),'windowbuttonmotionfcn',{@dragmarker,src})
> set(ancestor(src,'figure'),'windowbuttonupfcn',@stopdragging)
>
> function dragmarker(fig,ev,src)
> coords=get(gca,'currentpoint');
> x=coords(1,1,1);
> y=coords(1,2,1);
> set(src,'xdata',x,'ydata',y);
>
> function stopdragging(fig,ev)
> set(fig,'windowbuttonmotionfcn','')
> set(fig,'windowbuttonupfcn','')
>

nice !

Subject: is there any function to plot draggable points on plots?

From: Matt J

Date: 16 Nov, 2012 22:17:30

Message: 4 of 7

"Ha" wrote in message <k8636h$8ph$1@newscl01ah.mathworks.com>...
>
> ginput can plot points interactively but the points are not draggable.


If you have the Image Processing Toolbox, there is the IMPOINT command.

Subject: is there any function to plot draggable points on plots?

From: Nasser M. Abbasi

Date: 16 Nov, 2012 22:35:03

Message: 5 of 7

On 11/16/2012 4:17 PM, Matt J wrote:
> "Ha" wrote in message <k8636h$8ph$1@newscl01ah.mathworks.com>...
>>
>> ginput can plot points interactively but the points are not draggable.
>
>
> If you have the Image Processing Toolbox, there is the IMPOINT command.
>

That is what is really so annoying with Matlab. Different functions that one
needs exist in different toolboxes that one must buy, instead of having
one fully integrated system which contains everything out of the box
like with Mathematica.

It is really annoying. Mathematica has everything in the kernel. No
toolboxes to worry about. I wish Mathworks would fix this old
broken policy. They can raise the price a little and sell one system and
have everything in one box.

Being too greedy is not a good thing. There are many other options
now out there other than Matlab.

--Nasser

Subject: is there any function to plot draggable points on plots?

From: Matt J

Date: 17 Nov, 2012 00:08:21

Message: 6 of 7

"Nasser M. Abbasi" <nma@12000.org> wrote in message <k86f2q$fkc$1@speranza.aioe.org>...
>
> It is really annoying. Mathematica has everything in the kernel. No
> toolboxes to worry about. I wish Mathworks would fix this old
> broken policy. They can raise the price a little and sell one system and
> have everything in one box.
>
> Being too greedy is not a good thing. There are many other options
> now out there other than Matlab.
================


Dunno. I can believe that the development effort of all the toolboxes is many times that of core MATLAB, and some of those toolboxes I know I don't need and don't want to be forced to pay for. I do sometimes wonder, though, whether core MATLAB should cost ~$1000/license, but I don't have an educated way of appraising that.

Subject: is there any function to plot draggable points on plots?

From: Ha

Date: 17 Nov, 2012 14:26:13

Message: 7 of 7

"Matt J" wrote in message <k86e1q$ks5$1@newscl01ah.mathworks.com>...
> "Ha" wrote in message <k8636h$8ph$1@newscl01ah.mathworks.com>...
> >
> > ginput can plot points interactively but the points are not draggable.
>
>
> If you have the Image Processing Toolbox, there is the IMPOINT command.

Bingo. That's it. Thx.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us