Solved. As the plots are created over loop, got to make conditional (if-else) palette based on color count. Sample below.