Step Gradients with a Given Number of Steps

Let’s say we want some stepped gradients like the ones below, with a certain number of steps.