|
Yoav Mor wrote:
>
>
> Hi,
>
> I'm creating a subplot and a line notation on top.
> I'm trying to pin my line to the plot and cannot find any function
> that does so.
>
> my schematic code is:
>
> -------------------------------------------------
> a = figure();
> b(1) = subplot (2,1,1);
> b(2) = subplot (2,1,2);
> plot (b(1),[1:10:1000]);
> plot (b(2),[1000:-10:1]);
> anno2 = annotation('line',[0.5 0.5],[0.2 0.8]);
> % <- At this stage I want to pin it...
> -------------------------------------------------
>
> of course that by right-clicking on the annotation I can perform
> this
> but I need to do it dynamically within my function.
>
> Is that possible?
Hi Yoav!
I assume that you are familiar with handle graphics, i.e. working
with set/get inside your code to customize plots etc. If you are not,
then read that part of the documentation. Looking at anno2 using get,
you´ll see that the only thing that happens is that two children are
added to the annotation object:
% run your posted code:
v=get(anno2,'Children')
% pin the line by right-clicking and so on ...
v2=get(anno2,'Children')
Now you can see that two more handles have been added to your stack
of Children. Take a look at them, again using get:
a1=get(v2(1))
a2=get(v2(2))
As you can see these are line object with some properties. I think
that all you´ll have to do is to find out a way to reproduce a these
lineobjects and add them as children to your annotation.
Anyway, this is just the way I would handle this.
HTH
PB
|