Rotate rectangle x number of degrees when using imrect or alternative function
5 visualizaciones (últimos 30 días)
Right Grievous el 5 de Abr. de 2014
I would like to allow a user to draw a rectangle over a plot to highlight some data. This seems entirely possible using imrect, however I sometimes need the rectangle to be rotated 60 degrees to the x axis. I can't find any mention of rotation in the help or by using get(h).
I've looked for some help on this function but strangely it doesn't seem to be widely used. Does anybody know how to rotate a rectangle when using imrect, or are there alternatives which do allow it?
Image Analyst el 5 de Abr. de 2014
You can get the vertices of the corners. Then use the rotation matrix (see Wikipedia) to rotate it about its center by any angle. Then redraw the rectangle with plot().