jeanluct / braidlab

Matlab package for analyzing data using braids
GNU General Public License v3.0
23 stars 9 forks source link

Output handle for loop plot #141

Open allshouse opened 6 years ago

allshouse commented 6 years ago

It would be a helpful option for the user to get the handles of the line segments that make up the loop plots. There are currently no outputs of the loop function. Having each plotted segments being a handle will allow the user to modify segments of the line but also pass through the coordinates of the lines.

jeanluct commented 6 years ago

I created a feature branch for this. I'm trying to first make sure the behavior of the function mimics what is "expected" based on other commands. For instance, for builtin plot.m:

%   PLOT returns a column vector of handles to lineseries objects, one
%   handle per plotted line.

So each call to plot returns a handle to one line, or more than one line for the form plot(x1,f1,x2,f2,...). So I guess the thing to do is to gather the handles as plot the different loops, and bundle these in a 2x1 array.

jeanluct commented 6 years ago

Just to make sure I understand: you actually want a handle for each segment, not just for each loop? It sounds to me better to have a handle to each loop. (Though this is actually a bit harder to do with the current setup.)

allshouse commented 6 years ago

A handle for each segment would be fine. The main goal is to output the coordinates of the line that make up the loop. This would give an initial guess of what the loop looks like so we can modify it to make a simplified representation of the loop in physical space.

jeanluct commented 6 years ago

A handle for each segment is kind of ugly, though. It might work as a kludge but is not the natural thing to do. I've been tinkering with how to return a handle to each loop. The idea is to always use Marko's 'Components' option and save the points drawn by component. Then only plot everything one at the end, so that each loop gets one handle.

The problem is that the semicircles and lines making up a loop are plotted out of order right now, so this creates extraneous lines criss-crossing the loop. Either (i) they should be generated in the right order; or (ii) they should be sorted afterwards. I'm leaning towards option (ii) right now. This is not such a bad programming project, but will take me a bit of time.