From cdb623292d7294a5a92199cd0c1637528e5b9bf3 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:21:37 +0100 Subject: [PATCH] DOC: Cleanup scales examples - Remove https://matplotlib.org/3.9.3/gallery/scales/log_bar.html The only scale-related aspect of the example is `ax.set_yscale("log")`. That's not something we need an extra example for. The scale works for all data content. We don't need to show that it also works for bars. Even worse, the example creates grouped bars, which require extra code and therefore distract from the scale aspect. - Rename some example titles "Demo" -> "scale" --- galleries/examples/scales/asinh_demo.py | 6 ++--- galleries/examples/scales/log_bar.py | 29 ------------------------- galleries/examples/scales/logit_demo.py | 6 ++--- galleries/examples/scales/scales.py | 6 ++--- 4 files changed, 9 insertions(+), 38 deletions(-) delete mode 100644 galleries/examples/scales/log_bar.py diff --git a/galleries/examples/scales/asinh_demo.py b/galleries/examples/scales/asinh_demo.py index a464d4546ea8..bc8b010c47ce 100644 --- a/galleries/examples/scales/asinh_demo.py +++ b/galleries/examples/scales/asinh_demo.py @@ -1,7 +1,7 @@ """ -============ -Asinh Demo -============ +=========== +Asinh scale +=========== Illustration of the `asinh <.scale.AsinhScale>` axis scaling, which uses the transformation diff --git a/galleries/examples/scales/log_bar.py b/galleries/examples/scales/log_bar.py deleted file mode 100644 index 239069806c5c..000000000000 --- a/galleries/examples/scales/log_bar.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -======= -Log Bar -======= - -Plotting a bar chart with a logarithmic y-axis. -""" -import matplotlib.pyplot as plt -import numpy as np - -data = ((3, 1000), (10, 3), (100, 30), (500, 800), (50, 1)) - -dim = len(data[0]) -w = 0.75 -dimw = w / dim - -fig, ax = plt.subplots() -x = np.arange(len(data)) -for i in range(len(data[0])): - y = [d[i] for d in data] - b = ax.bar(x + i * dimw, y, dimw, bottom=0.001) - -ax.set_xticks(x + dimw / 2, labels=map(str, x)) -ax.set_yscale('log') - -ax.set_xlabel('x') -ax.set_ylabel('y') - -plt.show() diff --git a/galleries/examples/scales/logit_demo.py b/galleries/examples/scales/logit_demo.py index a21abf5b64fb..22a56433ccd7 100644 --- a/galleries/examples/scales/logit_demo.py +++ b/galleries/examples/scales/logit_demo.py @@ -1,7 +1,7 @@ """ -================ -Logit Demo -================ +=========== +Logit scale +=========== Examples of plots with logit axes. """ diff --git a/galleries/examples/scales/scales.py b/galleries/examples/scales/scales.py index 8df4d2fdd4a9..e932609bb7f9 100644 --- a/galleries/examples/scales/scales.py +++ b/galleries/examples/scales/scales.py @@ -1,7 +1,7 @@ """ -====== -Scales -====== +=============== +Scales overview +=============== Illustrate the scale transformations applied to axes, e.g. log, symlog, logit.