Can be used with the **with** statement::

        import litus
        import numpy as np
        import matplotlib.pylab as plt
        x = np.arange(0,10,0.1)
        with litus.figure("some_test.png") as f:
            plt.plot(x,np.cos(x))    # plots to a first plot
            with litus.figure("some_other_test.png"):
                plt.plot(-1*np.array(x)) # plots to a second plot
            plt.plot(x,np.sin(x))    # plots to the first plot again
            f.set_tight_layout(True) # using the figure object


    Or if they are to be used in an interactive console::


        import litus
        import numpy as np
        import matplotlib.pylab as plt
        x = np.arange(0,10,0.1)
        with litus.figure("some_test.png",display=True):
            plt.plot(x,np.cos(x))    # plots to a first plot
            with litus.figure("some_other_test.png",close=False):
                plt.plot(-1*np.array(x)) # plots to a second plot
            plt.plot(x,np.sin(x))    # plots to the first plot again

    Both of these figures will be displayed, but the second one will remain open and can be activated again.

def figure(path,display=False,close=True):
    """
    Can be used with the **with** statement::

        import litus
        import numpy as np
        import matplotlib.pylab as plt
        x = np.arange(0,10,0.1)
        with litus.figure("some_test.png") as f:
            plt.plot(x,np.cos(x))    # plots to a first plot
            with litus.figure("some_other_test.png"):
                plt.plot(-1*np.array(x)) # plots to a second plot
            plt.plot(x,np.sin(x))    # plots to the first plot again
            f.set_tight_layout(True) # using the figure object


    Or if they are to be used in an interactive console::


        import litus
        import numpy as np
        import matplotlib.pylab as plt
        x = np.arange(0,10,0.1)
        with litus.figure("some_test.png",display=True):
            plt.plot(x,np.cos(x))    # plots to a first plot
            with litus.figure("some_other_test.png",close=False):
                plt.plot(-1*np.array(x)) # plots to a second plot
            plt.plot(x,np.sin(x))    # plots to the first plot again

    Both of these figures will be displayed, but the second one will remain open and can be activated again.


    """
    return Figure(path,display=display,close=close)