some stuffs added for direct plotting