I think I just figured it out by setting using a bool and setting it to false at the beginning. Then just before attaching the axis determine axis visibility. If the bool is false, set the axis visibility to true then set the bool to true. The next time thru, the bool will be true and set visibility to false. I ge both lines and only one set of scales.

if (axisXHasBeenAdded == false)
{
axisX->setVisible(true);
axisXHasBeenAdded = true;
}
else
{
axisX->setVisible(false);
}