Skip to content

Rotating Cartesian axes #594

Answered by johannes-wolf
psads-git asked this question in Q&A
Discussion options

You must be logged in to vote

You can just use rotate(<angle>) to rotate around the z-axis (or any axis if you specify the axis name as named parameter).
Example:

#import "@preview/cetz:0.2.2": canvas, draw
#set page(width: auto, height: auto, margin: .5cm)

#canvas({
  import draw: *

  set-style(mark: (length: .1, width: .2))
  
  line((-2, 0), (2, 0), mark: (end: "barbed"))
  line((0, -2), (0, 2), mark: (end: "barbed"))

  line((0,1), (1,1), (1,0), stroke: (dash: "dashed"))

  line((0,0), (1,1), mark: (end: "barbed"), stroke: red)

  group({
    rotate(30deg)
    stroke(blue)
    line((-2, 0), (2, 0), mark: (end: "barbed"))
    line((0, -2), (0, 2), mark: (end: "barbed"))
  })
})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@psads-git
Comment options

Answer selected by psads-git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants