subimage precise getting
some debug code added
graph refined, figure counter simplified