general form of matplotlib plotting of two functions