Generating figures code