generalising plot_function arguments