Creates figure, toolbar, layout, sets widget layout

    Returns figure, canvas, layout

    Reference: http://stackoverflow.com/questions/12459811

def get_matplotlib_layout(widget, flag_toolbar=True):
    """
    Creates figure, toolbar, layout, sets widget layout

    Returns figure, canvas, layout

    Reference: http://stackoverflow.com/questions/12459811

    """
    fig = plt.figure()
    canvas = FigureCanvas(fig)
    #        self.canvas.mpl_connect('button_press_event', self.on_plot_click)
    layout = QVBoxLayout(widget)
    if flag_toolbar:
        toolbar = NavigationToolbar2QT(canvas, widget)
        layout.addWidget(toolbar)
    layout.addWidget(canvas)
    a99.set_margin(layout, 0)

    return fig, canvas, layout