| 231 | # Modified from: |
| 232 | # https://github.com/WolframRhodium/muvsfunc/blob/d5b2c499d1b71b7689f086cd992d9fb1ccb0219e/muvsfunc.py#L5807 |
| 233 | def save_plot(self, vals): |
| 234 | plot = pyplot |
| 235 | plot.close('all') |
| 236 | plot.style.use('dark_background') |
| 237 | fig, ax = plot.subplots(figsize=(12, 8)) |
| 238 | ax.plot(range(self.min_h, self.max_h + 1, self.steps), vals, '.w-') |
| 239 | dh_sequence = tuple(range(self.min_h, self.max_h + 1, self.steps)) |
| 240 | ticks = tuple(dh for i, dh in enumerate(dh_sequence) if i % ((self.max_h - self.min_h + 10 * self.steps - 1) // (10 * self.steps)) == 0) |
| 241 | ax.set(xlabel="Height", xticks=ticks, ylabel="Relative error", title=self.filename, yscale="log") |
| 242 | if self.show_plot: |
| 243 | plot.show() |
| 244 | |
| 245 | return plot, fig |
| 246 | |
| 247 | # Original idea by Chibi_goku http://recensubshq.forumfree.it/?t=64839203 |
| 248 | # Vapoursynth port by MonoS @github: https://github.com/MonoS/VS-MaskDetail |