Plot Line Over Multiple Axes Simultaneously
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 1 Jul. 2012
Bearbeitet: Walter Roberson
am 1 Jul. 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.)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Graphics Performance finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!