added a plotting function in R