legend and auto scale for main window plot