From 85670a02b030633bd947a70aba7e3fca78604ede Mon Sep 17 00:00:00 2001 From: Vilim Lendvaj Date: Wed, 31 Mar 2021 21:53:12 +0200 Subject: [PATCH 1/2] Fix plot ticks. --- getnative/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getnative/app.py b/getnative/app.py index f6b417f..3b13d66 100755 --- a/getnative/app.py +++ b/getnative/app.py @@ -239,7 +239,7 @@ def save_plot(self, vals): plot.style.use('dark_background') fig, ax = plot.subplots(figsize=(12, 8)) ax.plot(range(self.min_h, self.max_h + 1, self.steps), vals, '.w-') - dh_sequence = tuple(range(500, 1001, self.steps)) + dh_sequence = tuple(range(self.min_h, self.max_h + 1, self.steps)) ticks = tuple(dh for i, dh in enumerate(dh_sequence) if i % (50 // self.steps) == 0) ax.set(xlabel="Height", xticks=ticks, ylabel="Relative error", title=self.filename, yscale="log") if self.show_plot: From 1a33cc10b471dfb0907a2d1fc0f6e4eaf9c02a15 Mon Sep 17 00:00:00 2001 From: Vilim Lendvaj Date: Wed, 31 Mar 2021 22:07:39 +0200 Subject: [PATCH 2/2] Fix plot ticks even better. Best guess to extrapolate the existing ticks for 500-1000 to arbitrary ranges. --- getnative/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getnative/app.py b/getnative/app.py index 3b13d66..5809c39 100755 --- a/getnative/app.py +++ b/getnative/app.py @@ -240,7 +240,7 @@ def save_plot(self, vals): fig, ax = plot.subplots(figsize=(12, 8)) ax.plot(range(self.min_h, self.max_h + 1, self.steps), vals, '.w-') dh_sequence = tuple(range(self.min_h, self.max_h + 1, self.steps)) - ticks = tuple(dh for i, dh in enumerate(dh_sequence) if i % (50 // self.steps) == 0) + 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) ax.set(xlabel="Height", xticks=ticks, ylabel="Relative error", title=self.filename, yscale="log") if self.show_plot: plot.show()