Refactor code, add support for specifying an offset into the plot

(useful to "zoom" on higher zoom levels)