MATLAB: How to rotate a quiver object in matlab

quiverrotate

I have a quiver object like this
q = quiver(x,y,u,v);
and then I use rotate to rotate it, but nothing happens
rotate(q,[0 0 1],180);
the command above works on a surf object, but not in a quiver one,why?
Thank you!

Best Answer

The rotate command actually modifies the data of the graphics object, and it doesn't know how to modify all of the different types of graphics objects. The quiver one, in particular is a bit tricky because some of the data represents directions instead of positions.
A more robust way to do this is to use the hgtransform command . It would look something like this:
g = hgtransform;
quiver(x,y,u,v,'Parent',g)
set(g,'Matrix',makehgtform('zrotate',pi/4))