Exactly what I needed!
One thing - when plotting different colors, the dotted grid lines tend to obscure the plot lines somewhat. Should they be grey instead of black? It's a very minor gripe, and I think the code is excellent.
In order to enhance the elegance of the diagram a lot, one should add the line property
to several functions in which the coordinate system is drawn. then the function becomes really nice!