Programatically rotating a picture in a graph

Hi!

Is there a way to rotate a picture in a graph around a predefined axis, i.e. vertical bottom, horizontal center of a picture, programatically? I would appreciate any help on this.

Actually I tried to put a picture into a TextBox and then rotating the TextBox which worked fine until a certain angle when the whole picture (in the TextBox) was not rotating any more around the same axis but suddenly "jumped" (translated). This happened for an angle more than -45 degrees (e.g. -50). I have set the anchor to Bottom Middle. Why is this happening?

Gregor
gregorK wrote:


Is there a way to rotate a picture in a graph around a predefined axis, i.e. vertical bottom, horizontal center of a picture, programatically? I would appreciate any help on this.


Hi Gregor,

ImageRotate sounds like what you are looking for. It will flip a matrix through an arbitrary angle; there are also flags for flipping horizontally and vertically as well as through multiples of 90 deg.
jtigor wrote:
ImageRotate sounds like what you are looking for. It will flip a matrix through an arbitrary angle; there are also flags for flipping horizontally and vertically as well as through multiples of 90 deg.


Hi, thanks for your help. I was more thinking of rotating the picture put in a draw environment, since I know the SetDrawEnv has an option "rotate", but I do not know how to use it to rotate a picture around a specific point (axis).

Anyways, I will look into ImageRotate too, so thanks for your input!

Gregor

--
Gregor K
ALOISA Beamline
Elettra Synchrotron
The rotate option of SetDrawEnv rotates the coordinate system, not the objects themselves. You can use a rotated coordinate system if you want to draw objects.

Can you post some example code where the textbox rotation fails?
thomas_braun wrote:

Can you post some example code where the textbox rotation fails?


Thanks Thomas. I do not have a code to show, I was just playing with the TextBox rotation itself (from the Modify Annotation window). I use Igor 6.37 on a Mac.
The options I used were Anchor=Middle Bottom, Position=Moveable, offsets=0 (or some other value it does not matter it seems), and then changing the Rotation: Fixed Angle to negative value up to -45 works as expected, for (absolutely) larger values (e.g. -50) it rotates the annotation plus it suddenly jumps laterally to a new position ... I just checked, the same thing happens also for positive values of the rotation angle.

The same thing happens if I use a simple TextBox with text inside, so it is not related to the picture in the TextBox.

--
Gregor K
ALOISA Beamline
Elettra Synchrotron
gregorK wrote:

The options I used were Anchor=Middle Bottom, Position=Moveable, offsets=0 (or some other value it does not matter it seems), and then changing the Rotation: Fixed Angle to negative value up to -45 works as expected, for (absolutely) larger values (e.g. -50) it rotates the annotation plus it suddenly jumps laterally to a new position ... I just checked, the same thing happens also for positive values of the rotation angle.


I tried this with IP6.38 and Win7 and saw the same behavior with a text box with only text. If the anchor point is Middle Center, the lateral position does not change (at least for the relatively short piece of text that I was using). I suspect the movement is some effort by Igor to keep the label from falling off the plot or from covering tic labels.

I also tried this with a text string long enough to go off the plot area under certain rotations. With the anchor set to Middle Center, the lateral position did not change under a wide range of rotation angles.