Is there any alternate of "axes(handles.axes1)"

5 views (last 30 days)
yogesh jain
yogesh jain on 3 Mar 2016
Edited: Adam on 3 Mar 2016
Hello all; In GUI while I am using multiple axes and using "axes(handles.axes1)" command , I feel it takes much time. For example -
axes(handles.axes1);
// functionality
axes(handles.axes2);
// functionality
axes(handles.axes3);
// functionality
then profiler shows that line consumes more time . I want to reduce taken time , is there any alternative of that ?
Thank you

Answers (1)

Adam
Adam on 3 Mar 2016
Edited: Adam on 3 Mar 2016
All plot functions take an axes as either the first argument or they allow you to set 'Parent', hAxes as part of the property-value pair syntax.
I always use this nowadays instead of the syntax you showed above. It is more explicit and less prone to errors because it tells the plot instruction exactly which axes to plot on whereas the syntax you show simply sets an axes to be the current axes and then plots to the current axes. This also has the, sometimes undesirable, effect of bringing that axes into focus. I quite often want to plot something on an axes in a multi-window GUI without having the window containing that axes jump to the front.
So, e.g.
plot( hAxes, xData, yData );
is better than
axes( hAxes )
plot( xData, yData );
where hAxes is your axes handle. For imagesc or imshow:
imagesc( someImage, 'Parent', 'hAxes' )
imshow( someImage, 'Parent', 'hAxes' )

Categories

Find more on Specifying Target for Graphics Output in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!