Working version with plot
Handle device orientation changes