2
$\begingroup$
PolarPlot[Exp[θ], {θ, 0, 10}]  

I get plot as below:

spiral

If I need to rotate and move this object as below:

transformed spiral

What function can I use?

I ask this question because I need to know the general method to rotate and move object. I ask a similar question about ContourPlot, it seemed there's no general method for all plot function.

$\endgroup$
  • 2
    $\begingroup$ What you show doesn't look like a simple rotation. Can you be more precise about specifying the geometric transform you actually want? $\endgroup$ – m_goldberg Mar 7 '18 at 12:33
  • $\begingroup$ Does this answer both of your questions? rotated PolarPlot with Show $\endgroup$ – Kuba Mar 8 '18 at 7:07
7
$\begingroup$

If you use ParametricPlot[] instead, things are easier:

ParametricPlot[Composition[TranslationTransform[{-3000, -100}], RotationTransform[-120 °]][
               Exp[θ] AngleVector[θ]] // Evaluate, {θ, 0, 10}]

translated and rotated spiral

Note that multiplying your polar function with AngleVector[θ] (equivalently, {Cos[θ], Sin[θ]}) converts it into an equivalent form that can be used by ParametricPlot[].

$\endgroup$
3
$\begingroup$

I would say that it is not a good idea to try to apply geometric transformations to a Graphics object. One should better attack the geometric objects (the graphics primitives such as GraphicsComplex, Polygon, Line, Point, ...) inside a Graphics objects.

Let's start with the graphic you supplied. (Note that I specify a concise PlotRange in order to prevent myself from running into some problems with inconsistencies among the handling Options different plot types.)

g = PolarPlot[Exp[θ], {θ, 0, 10}, PlotRange -> {{-100, 100}, {-100, 100}}]

enter image description here

The relevant primitive here is Line as can be seen from the InputForm of g. In the following I Rotate anything that evaluates to True under RegionQ by Pi/3 about the point {0,0} and Translate it afterwards by {0,10}. Thanks to JEM_Mosig for pointing out that RegionQ can be used.

 g /. {x_?RegionQ :> Translate[Rotate[x, Pi/3, {0, 0}], {0,10}]}

enter image description here

This should work with slight modifications for arbitrary plot types (also 3D plots) and for all graphics primitives.

$\endgroup$
  • 2
    $\begingroup$ Nice :-) Using x_?RegionQ instead of x_Line is a bit more general. $\endgroup$ – JEM_Mosig Mar 7 '18 at 21:47
  • $\begingroup$ @JEM_Mosig Yeah, good idea. Actually I am spelunking for a GraphicsPrimitiveQ function... Haven't been successful, yet... =/ $\endgroup$ – Henrik Schumacher Mar 7 '18 at 21:48
  • $\begingroup$ @HenrikSchumacher,g = PolarPlot[Abs[t]/3, {t, -Pi, Pi}, PlotRange -> {{-1, 1}, {-1, 1}}] doesn't work in your script g /. {x_RegionQ :> Translate[Rotate[x, Pi/3, {0, 0}], {0,10}]} $\endgroup$ – kittygirl Mar 8 '18 at 1:31
  • $\begingroup$ @kittygirl Oops. Typo. It has to be x_?RegionQ (with a question mark). $\endgroup$ – Henrik Schumacher Mar 8 '18 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.