I’m looking for options to change color of Tick Mark & Tick Text (Tick Mark / Observable Plot / Observable / Observable) based on conditions in tickformat. Is there option to realize this?
I could not find answers in github, talk and stackoverflow.
I’m looking for options to change color of Tick Mark & Tick Text (Tick Mark / Observable Plot / Observable / Observable) based on conditions in tickformat. Is there option to realize this?
I could not find answers in github, talk and stackoverflow.
There is no baked-in solution in Plot, but you can modify the svg with d3:
Selection via the new aria-label
- awesome!!
I’ve added a second example which uses only css.
Works perfectly.
Thanks a lot.
You can also render the ticks yourself using a tick and a text mark (and some manual positioning):
Plot.plot({
x: { domain: [0, 1], ticks: [] },
marks: [
Plot.dotX(Array.from({ length: 100 }, Math.random)),
Plot.tickX(d3.ticks(0, 1, 10), { stroke: x => x, dy: 6, insetTop: 23 }),
Plot.textX(d3.ticks(0, 1, 10), { fill: x => x, dy: 16, text: x => x.toFixed(1), frameAnchor: "bottom" })
]
})