Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clipping issues with hypographs #85

Open
jamesrswift opened this issue Nov 2, 2024 · 0 comments
Open

Clipping issues with hypographs #85

jamesrswift opened this issue Nov 2, 2024 · 0 comments
Labels
👿 bug Something isn't working

Comments

@jamesrswift
Copy link
Collaborator

MRE:

#import "@preview/cetz:0.3.1"
#import "@preview/cetz-plot:0.1.0"

#cetz.canvas({
  cetz-plot.plot.plot(
    size: (10, 6),
    y-min: 0, y-max: 0.8,
    x-tick-step: 1,
    plot-style: (n)=>{
      (green, yellow, red)
        .map(i=>(stroke: i.darken(20%), fill: i.lighten(75%)))
        .at(calc.abs(2-n))
    },
    {
      cetz-plot.plot.add(x=>calc.exp(-calc.pow(x,2)), domain: (-3,-2), hypograph: true)
      cetz-plot.plot.add(x=>calc.exp(-calc.pow(x,2)), domain: (-2,-1), hypograph: true)
      cetz-plot.plot.add(x=>calc.exp(-calc.pow(x,2)), domain: (-1,1), hypograph: true)
      cetz-plot.plot.add(x=>calc.exp(-calc.pow(x,2)), domain: (1,2), hypograph: true)
      cetz-plot.plot.add(x=>calc.exp(-calc.pow(x,2)), domain: (2,3), hypograph: true)
    }
  )
})

image

Changing y-max produces different flavours of the bug, as does y-min (but less perceptibly in this example).

I suspect it is something to do with the util.clipped-paths(points, low, high, fill: false) function. I remember that this (or something related to clipping) got updated in #27 - did that get ported over to main or #81 ?

@johannes-wolf johannes-wolf added the 👿 bug Something isn't working label Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👿 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants