Move figure export function to common tools directory.
Adapt main scripts and figure generation fucntion to last changes.