[Waterloo] Draggable Line?

1 visualizzazione (ultimi 30 giorni)
H.A. Camp
H.A. Camp il 11 Dic 2012
I'm finding the Waterloo package very useful to enhance Matlab plots. However, I'm still wrapping my head around how to work directly with some of the Java objects. (Clearly, I'm not a Java programmer!)
For example, I have a very simple GXGraph() plot:
% Generate some fake data
x = linspace(-10, 10, 100); % X Data
y = sin(x./10 .* 2 .* pi); % Y Data
% Plot the Data
gfig = GXFigure(); % Waterloo figure handle
gr1 = subplot(gfig, 1, 1, 1); % Create Graph 1 (gr1)
data1 = scatter(gr1, x, y); % Plot a scatter graph
(Of course, the above example only works after Waterloo has been added to MATLAB's path, and the initial 'waterloo.m' script has been run.)
Now, I'd like to add a line to my graph. I can do this:
% Add a line
annotation(gr1, 'line', [5, 5], [-1, 1]); % Add Line
gr1.getObject().repaint(); % Update Graph
...But I don't know how to:
(1) allow the user to move the line
(2) add a callback to notify me when the line is moving
Ultimately, I'm trying to get something much like Matlab's native imrect() function -- I want to define a resizeable region on my GXGraph.
Any suggestions?

Risposta accettata

Image Analyst
Image Analyst il 11 Dic 2012
I don't think that will work. annotation works on the whole figure unfortunately, not on the units of the axes control itself like you'd want. There was a discussion of this within the past two weeks. You can create draggable lines with imdistline() or improfile(), both in the Image Processing Toolbox.
  3 Commenti
H.A. Camp
H.A. Camp il 12 Dic 2012
Ah, I see. Thanks, both of you, for the explanation.
I'm not after a moveable cursor so much as moveable regions of interest: we are plotting spectral data and need to limit the processing to a set of specific regions (say, only the leading and trailing edges, only the middle of the spectra, etc.)
Our spectral display quality has gone way up since switching to Waterloo (yay!) but we're having trouble implementing the equivalent of Matlab's imrect() function. I tried overlaying a matlab axis on top of a Waterloo axis, but found that the Z-order of the Waterloo plot is always on top (as you mentioned).
Perhaps we can use a small Matlab axis below the Waterloo plot to control the ROIs. We'll figure something out.
Malcolm Lidierth
Malcolm Lidierth il 30 Dic 2012
The Git repo now includes an imrect-like class: the GJRoi.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by