add the possibility to do plots using the weight variable