code for generating and comparing images

Just a reminder, can we move this logic to ``generate_or_test`` and then below just have:

```
        self.generate_or_test(generate, fig, 'image_plot')
```

?