I've a robot created with Peter Corke toolbox and I must plot it inside an app (must be in App Designer - Matlab). The problem is that everytime I try to plot it, it makes an independent figure outside the app. I've got the UIAxes created but I don't know if I can make it 'Parent' with a SerialLink.plot.

Is it even possible to plot it with SerialLink.plot or there's another way to do it?

Thanks in advance

Edit.: The plot must show an animation of different states using inverse kinematics. I can't do the animation either but I think after the plot issue, it should be easier.


1 Answer 1


Plot functions plot to the gca. gca is an abraviation for get current axis. It returns the handle to the currently selected axis, which will recieve the next plot.

You can take a look at the source code of the plot function you mentioned here: https://github.com/petercorke/robotics-toolbox-matlab/blob/master/%40SerialLink/plot.m

If you follow its logic, it seems that if you create a new axis on the UI and set it as the currently active axis and if this axis does not have a tag which is set to 'RTB.plot' then the plot will be made in the current axis.

If you want to set your preferred axis as the current axis, you can do this by calling:


Also, you might want to call hold on before plotting, as this will allow the next plot to be created in the same figure.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.