Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Rotation of 2D graphics

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26439] RE: [mg26432] Rotation of 2D graphics
  • From: PNichols at cornell-iowa.edu
  • Date: Thu, 21 Dec 2000 01:51:40 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Stephen,

Rotating the axes, labels and everything?

The short answer, which may be all you need, is FullGraphics:

?FullGraphics

"FullGraphics[g] takes a graphics object, and generates a new one in which
objects specified by graphics options are given as explicit lists of
graphics primitives."

==========================================================

A longer answer:

Needs["Graphics`Graphics`"];

?TransformGraphics

"TransformGraphics[graphics, f] applies the function f to all lists of
coordinates in graphics."

rotationmatrix[radians_]:=
{{Cos[radians],-Sin[radians]},{Sin[radians],Cos[radians]}}

generalrotation[point_, radians_, rotationcenter_]:=
    rotationmatrix[radians].(point-rotationcenter)+rotationcenter

ShowRotation[graphics_Graphics, radians_, rotationcenter_]:=
Show[
    TransformGraphics[
      FullGraphics[graphics],
      generalrotation[#, radians, rotationcenter] &
      ],
    AspectRatio -> Automatic]

sineplot = Plot[{Sin[6x], Sin[4x]}, {x, 0, 2},
    PlotStyle -> {{}, Hue[0]},
    PlotLabel -> "Two Frequencies"]

ShowRotation[sineplot, 25 Degree, {0,1}]

===========================================================
Is that what you want to do?  (If so, I'd be interested to know about your
broader purpose for this.)


Note:  FullGraphics turns tick labels (and PlotLabel settings, etc.) into
explicit Text primitives:  rotating the position of a Text primitive is
straightforward, rotating the actual text characters is much more work, and
may not be possible without building a new front end.




Preston Nichols
Visiting Assistant Professor of Mathematics
Cornell College 

-----Original Message-----
From: Stephen Sheppard [mailto:Stephen.C.Sheppard at williams.edu]
To: mathgroup at smc.vnet.net
Subject: [mg26439] [mg26432] Rotation of 2D graphics


I have some graphics generated by showing several 2d plots, and I would like
to be able to spin these about a specified point.  This is very easy if
everything has been generated using primitives like Line, Point, etc.  What
I would like to be able to do is to take an entire image that can be viewed
using "Show" and rotate it by r radians about the point {x,y}.  Something
like:

Show[%]

ShowRotate[%,r,{x,y}]
would then produce the graphic with everything (including the axes, labels,
etc.) rotated.

Any suggestions?  I would be happy if this were obvious.

Stephen Sheppard
Department of  Economics
Williams College




  • Prev by Date: Re: newbie question on sorting
  • Next by Date: RE: Rotation of 2D graphics
  • Previous by thread: Re: Rotation of 2D graphics
  • Next by thread: RE: Rotation of 2D graphics