more modularization/generalization of line-plot