Message Boards Message Boards

0
|
12438 Views
|
9 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Rotate the coordinate system

Posted 9 years ago
POSTED BY: Peter Parker
9 Replies
POSTED BY: Peter Parker
POSTED BY: Henrik Schachner

Hello

Thank you Henrik for your answer. Now it is perfectly working. I am wondering why the resolution of the tilted coordinate system is much lower than the other one. Should't Mathematica be able to rotate an image without decreasing the resolution? Maybe this is the advantage of Ottos solution.

Regards,

Peter

POSTED BY: Peter Parker
POSTED BY: Peter Parker

Hi Peter,

sorry for this issue! I still do not fully understand how this could have happened - obviously there was a change from version 9.0 (where I developed my first "solution") to version 10.2 (where I can now verify the problem). Anyway, here is the code which should run for version 10.2; it is even somewhat simpler:

img0 = Plot[0, {x, -10, 10}, PlotRange -> {{-10, 10}, {-5, 5}}, 
   ImageSize -> 500];
img1 = ImageRotate[
   Plot[3 + Sin[x], {x, -10, 10}, PlotRange -> {-5, 5}, 
    PlotStyle -> Green, ImageSize -> 500], -10 \[Degree]];
ImageCompose[img0, img1, {251, 150}]

Regards -- Henrik

POSTED BY: Henrik Schachner
POSTED BY: Otto Linsuain

Hi Peter,

here comes a crude approach, but maybe this goes in the right direction:

img0 = Image@
   RotateLeft[ (* `RotateLeft` is for fine tuning ... *)
    ImageData@
     ColorConvert[
      Plot[0, {x, -10, 10}, PlotRange -> {{-10, 10}, {-4, 4}}, 
       ImageSize -> 500], "Grayscale"], {0, 2}];

img1 = ImageRotate[
   Plot[3 + Sin[x], {x, -10, 10}, PlotRange -> {-4, 4}, 
    PlotStyle -> Green, ImageSize -> 500], -10 \[Degree], 
   Background -> White];

ImageMultiply[img1, img0]

which gives:

enter image description here

Regards -- Henrik

POSTED BY: Henrik Schachner

Hi

thank you Otto for your answer. This is only partially what I am looking for. The code that you gave me shows a cos-function rotated by an angle. Now I would like to have a second coordinate system on top of this plot which is rotated by the same angle. Just like in the picture I included in my first post. That is the big challenge for me.

Best regards,

Peter

POSTED BY: Peter Parker

Hello Peter,

Not sure whether this is what you are looking for. At least I hope it will provide a starting point:

ParametricPlot[
 Evaluate[Dot[RotationMatrix[\[Pi]/12], {x, Cos[x]}]], {x, -2*\[Pi], 
  2*\[Pi]}]

Not sure how to paste the image but it looks like a rotated cosine graph. Notice that the default AspectRatio for ParametricPlot is Automatic, meaning the horizontal and vertical scales are equal. This is different than the default value in Plot. This may become important if you want to display them together.

OL.

POSTED BY: Otto Linsuain
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract