Skip to content

Clipping issues with hypographs #85

Open
@jamesrswift

Description

@jamesrswift

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    👿 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions