It's nothing groundbreaking but I use this all the time and thought I should share it with other knowledge seekers. The function is very helpful if you're into plotting mechanisms and various angles within one axes.
Can this be easily modified for angles in the y-z plane?
It's useful, but it can only plot arcs < 180°, in other words span=[a,b] gives the same arc as span=[b,a]. If you don't want that, add e.g.
span(2) = span(2) + 2*pi;
before theta = ...
Worked well for me. Thank you!