There's that, and there's also the writers learning what different actors' strengths are, and what actors have chemistry together. To take an example from an even better show, Babylon 5: in season 1 the character of Susan Ivanova was a pretty stiff no-nonsense career military sort. But it turns out Claudia Christian was pretty good at banter and the occasional bit of humor, so that got written into the character as well. She was still tough-as-nails, but now with some added depth to her.
Of course, you sometimes have the opposite as well. It turned out that Alexander Siddig and Andrew Robinson had amazing chemistry with one another, and would play every scene with Dr Bashir and Garak with heavy doses of subtext and flirtation... which the Powers That Be did not like at all, so they gave them a lot fewer scenes in common.