Skip to content

Rotating and vertically flipping plots #529

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

You must be logged in to vote

But you could also (re-) plot with the axes swapped, which I think is the better solution:

#import "@preview/cetz:0.2.1"

#cetz.canvas({
  import cetz.plot
  import cetz.palette
  import cetz.draw: *


  plot.plot(size: (5,5),
    name: "plot",
    x-tick-step: 2,
    x-minor-tick-step: 1,
    y-tick-step: 2,
    y-minor-tick-step: 1,
    x-label: $ y $,
    y-label: $ x $,
    axis-style: "school-book", {
    plot.add(domain: (-0.3, 2.5),
      x => 2*x,
      style: palette.tango-light, axes: ("y", "x"))
    plot.add(domain: (-0.3, 2.5),
      x => calc.pow(x, 2),
      style: palette.tango-light, axes: ("y", "x"))
    plot.add(((2,0), (2,4)), 
            style: (stroke: (dash: "dashed…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
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
Labels
None yet
2 participants