0

I hope someone can assist me as I am pretty new to Mathematica and understanding the language is a bit of a hurdle.

I am trying to rotate a plot of interlaced circles by some angle without rotating the axis and this is the method that somewhat worked the best.

Show[
    Normal[someplot] /. prim : _Line | _Point | _Polygon :> 
           GeometricTransformation[prim, RotationTransform[Pi/20]], PlotRange -> All, AspectRatio -> Automatic
     ]

From the highest rated answer in the link below:

How to rotate the curve but not the axes?

I would please like to know what the code below is doing. Particularly the "/. prim : _Line | _Point | _Polygon :>" part.

Thank you dearly.

Michael E2
  • 235,386
  • 17
  • 334
  • 747
Jetty
  • 1

1 Answers1

4

Normal[p] is needed to replace GraphicsComplex by a full form with all coodinates.

prim : _Line | _Point | _Polygon is a pattern that matches a line, point or polygon.

:> GeometricTransform[prim,..] replaces the matched line, point or polygon by a rotated version of it.

Here is a small example:

p= Graphics[{Line[{{0, 0}, {1, 1}}], Point[{1, 0.5}]}, Axes -> True]

p /. prim : _Line | _Point | _Polygon :> 
  GeometricTransformation[prim, RotationTransform[Pi/2]] 

enter image description here

Jason B.
  • 68,381
  • 3
  • 139
  • 286
Daniel Huber
  • 51,463
  • 1
  • 23
  • 57