Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9aa02c6

Browse files
authored
Merge pull request #7685 from efiring/doc_log_ticker
DOC: add example plot for LogFormatter in dflt_style_changes
2 parents 21eb2ed + 3b1f5da commit 9aa02c6

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

doc/users/dflt_style_changes.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,28 @@ ticks. See `~matplotlib.ticker.LogFormatter` for details. The
10571057
minor tick labeling is turned off when using ``mpl.style.use('classic')``,
10581058
but cannot be controlled independently via ``rcParams``.
10591059

1060+
.. plot::
1061+
1062+
import numpy as np
1063+
import matplotlib.pyplot as plt
1064+
1065+
np.random.seed(2)
1066+
1067+
fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(6, 3))
1068+
fig.subplots_adjust(wspace=0.35, left=0.09, right=0.95)
1069+
1070+
x = np.linspace(0.9, 1.7, 10)
1071+
y = 10 ** x[np.random.randint(0, 10, 10)]
1072+
1073+
ax2.semilogy(x, y)
1074+
ax2.set_title('v2.0')
1075+
1076+
with plt.style.context('classic'):
1077+
ax1.semilogy(x, y)
1078+
ax1.set_xlim(ax2.get_xlim())
1079+
ax1.set_ylim(ax2.get_ylim())
1080+
ax1.set_title('classic')
1081+
10601082

10611083
``ScalarFormatter`` tick label formatting with offsets
10621084
======================================================

0 commit comments

Comments
 (0)