Skip to content

How to set numeric tick interval? #1994

Closed
@vwkd

Description

@vwkd

Description

According to the types, tick can be a RangeInterval which can be a number defining the tick interval.

a number (for number intervals), defining intervals at integer multiples of n

However, this conflicts with another type of tick which can be a number defining the tick amount.

From testing, it seems setting tick to a number is always interpreted as tick amount.

How can I set a numeric tick interval?

Steps To Reproduce

const data = [
  {x: 0, y: 0},
  {x: 1, y: 1},
  {x: 2, y: 2},
  {x: 3, y: 3},
  {x: 4, y: 4},
  {x: 5, y: 5},
]

Plot.plot({
  x: {
    ticks: 1
  },
  marks: [
    Plot.line(data, { x: "x", y: "y" })
  ]
})

Expected Result

Tick interval of 1, i.e. tick amount of 5.

tick_interval2

Actual Result

Tick amount of 1, i.e. tick interval of 5.

tick_interval

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions