From 261dbf4e98580914751f3abf23872e003c3b554c Mon Sep 17 00:00:00 2001 From: Adrien F Vincent Date: Sun, 17 Jul 2016 20:12:09 +0200 Subject: [PATCH 1/2] Suppr. minor y-ticklabels w/ logit scale --- doc/pyplots/pyplot_scales.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/pyplots/pyplot_scales.py b/doc/pyplots/pyplot_scales.py index 23e60039bf7c..6bb4e99464ad 100644 --- a/doc/pyplots/pyplot_scales.py +++ b/doc/pyplots/pyplot_scales.py @@ -1,6 +1,8 @@ import numpy as np import matplotlib.pyplot as plt +from matplotlib.ticker import NullFormatter # useful for `logit` scale + # make up some data in the interval ]0, 1[ y = np.random.normal(loc=0.5, scale=0.4, size=1000) y = y[(y > 0) & (y < 1)] @@ -39,5 +41,12 @@ plt.yscale('logit') plt.title('logit') plt.grid(True) +# Format the minor tick labels of the y-axis into empty string with +# the `NullFormatter`, to avoid cumbering it with too many labels. +plt.gca().yaxis.set_minor_formatter(NullFormatter()) +# Adjust the subplot layout, because the logit one may take more space than +# usual, due to y-tick labels like "1 - 10^3" +plt.subplots_adjust(top=0.92, bottom=0.08, left=0.10, right=0.95, hspace=0.25, + wspace=0.35) plt.show() From c97fea9a0d1c2c0d76a1c775ca2bca859568a4a5 Mon Sep 17 00:00:00 2001 From: Adrien F Vincent Date: Sun, 17 Jul 2016 20:15:47 +0200 Subject: [PATCH 2/2] Tweak linthreshy to avoid overlap of y-ticklabels --- doc/pyplots/pyplot_scales.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/pyplots/pyplot_scales.py b/doc/pyplots/pyplot_scales.py index 6bb4e99464ad..ce8f1c02e4f6 100644 --- a/doc/pyplots/pyplot_scales.py +++ b/doc/pyplots/pyplot_scales.py @@ -31,7 +31,7 @@ # symmetric log plt.subplot(223) plt.plot(x, y - y.mean()) -plt.yscale('symlog', linthreshy=0.05) +plt.yscale('symlog', linthreshy=0.01) plt.title('symlog') plt.grid(True)