diff --git a/examples/tests/backend_driver.py b/examples/tests/backend_driver.py index 5ad48da75038..e084e032f9d8 100755 --- a/examples/tests/backend_driver.py +++ b/examples/tests/backend_driver.py @@ -205,7 +205,7 @@ 'multiline.py', 'multiple_figs_demo.py', 'nan_test.py', - 'newscalarformatter_demo.py', + 'plot_scalarformatter.py', 'pcolor_demo.py', 'pcolor_log.py', 'pcolor_small.py', diff --git a/examples/pylab_examples/newscalarformatter_demo.py b/examples/ticks_and_spines/plot_scalarformatter.py similarity index 75% rename from examples/pylab_examples/newscalarformatter_demo.py rename to examples/ticks_and_spines/plot_scalarformatter.py index 381ced7f3b49..ef04408b8dd3 100644 --- a/examples/pylab_examples/newscalarformatter_demo.py +++ b/examples/ticks_and_spines/plot_scalarformatter.py @@ -1,31 +1,21 @@ -import matplotlib.pyplot as plt -import numpy as np -from matplotlib.ticker import OldScalarFormatter, ScalarFormatter +""" +========================================= +Tick formatting using the ScalarFromatter +========================================= -# Example 1 -x = np.arange(0, 1, .01) -fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) -fig.text(0.5, 0.975, 'The old formatter', - horizontalalignment='center', verticalalignment='top') -ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5) -ax1.xaxis.set_major_formatter(OldScalarFormatter()) -ax1.yaxis.set_major_formatter(OldScalarFormatter()) - -ax2.plot(x * 1e5, x * 1e-4) -ax2.xaxis.set_major_formatter(OldScalarFormatter()) -ax2.yaxis.set_major_formatter(OldScalarFormatter()) +The example shows use of ScalarFormatter with different settings. -ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10) -ax3.xaxis.set_major_formatter(OldScalarFormatter()) -ax3.yaxis.set_major_formatter(OldScalarFormatter()) +Example 1 : Default -ax4.plot(-x * 1e5, -x * 1e-4) -ax4.xaxis.set_major_formatter(OldScalarFormatter()) -ax4.yaxis.set_major_formatter(OldScalarFormatter()) +Example 2 : With no Numerical Offset -fig.subplots_adjust(wspace=0.7, hspace=0.6) +Example 3 : With Mathtext +""" +import matplotlib.pyplot as plt +import numpy as np +from matplotlib.ticker import ScalarFormatter -# Example 2 +# Example 1 x = np.arange(0, 1, .01) fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) fig.text(0.5, 0.975, 'The new formatter, default settings', @@ -50,7 +40,7 @@ fig.subplots_adjust(wspace=0.7, hspace=0.6) -# Example 3 +# Example 2 x = np.arange(0, 1, .01) fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) fig.text(0.5, 0.975, 'The new formatter, no numerical offset', @@ -75,7 +65,7 @@ fig.subplots_adjust(wspace=0.7, hspace=0.6) -# Example 4 +# Example 3 x = np.arange(0, 1, .01) fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6)) fig.text(0.5, 0.975, 'The new formatter, with mathtext',