preparePlot function

Prepare graphics device