Plot Line Over Multiple Axes Simultaneously
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Walter Roberson
2012 年 7 月 1 日
編集済み: Walter Roberson
2012 年 7 月 1 日
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.)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Graphics Performance についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!