better resizing of graphs