Plot Line Over Multiple Axes Simultaneously
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello all,
I am try to develop a GUI to play through data in time and examine different traces. Much like a audio recording interface. I'm having a difficult time getting the cursor behavior to work ok. I'm wondering if there is a better (faster) way to plot a vertical line over multiple plots rather than calling a for loop to loop through the axes. Here's what I mean (I define handles.cursor.xLocation from the mouse click position):
for j = 1:length(axesHandles)
axes(axesHandles(j))
yLimits = get(axesHandles(j),'YLim');
hCursor = line(handles.cursor.xLocation*[1 1],yLimits,'Color','r');
handles.cursor.handles(j) = hCursor;
end
This generates a considerable lag when plotting through this loop and was wondering if there was a better way??? Any help would be much appreciated!
Jeff
0 Commenti
Risposta accettata
Walter Roberson
il 1 Lug 2012
Modificato: Walter Roberson
il 1 Lug 2012
You mention "cursor behavior". Does that imply you are moving the lines? If so then it is better to set() the XData and YData of each of the lines rather than creating a new line() object each time.
You do not need the axes() call, and it is slowing you down. Instead, specify the axes in the line() call:
handles.cursor.handles(j) = line( handles.cursor.xLocation([1 1]), yLimits, 'Color', 'r', 'Parent', axesHandles(j) );
(I also optimized the *[1 1] that was being used for replication.)
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Subplots in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!