added function support for easy creation of figures