forked from matplotlib/devdocs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdflt_style_changes-5.py
More file actions
38 lines (30 loc) · 945 Bytes
/
dflt_style_changes-5.py
File metadata and controls
38 lines (30 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from cycler import cycler
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(6, 3))
N = 15
x = np.arange(N)
y = np.ones_like(x)
sty_cycle = (cycler('ls', ['--' ,':', '-.']) *
cycler('lw', [None, 1, 2, 5]))
classic = {
'lines.linewidth': 1.0,
'lines.dashed_pattern' : [6, 6],
'lines.dashdot_pattern' : [3, 5, 1, 5],
'lines.dotted_pattern' : [1, 3],
'lines.scale_dashes': False}
v2 = {}
# {'lines.linewidth': 1.5,
# 'lines.dashed_pattern' : [2.8, 1.2],
# 'lines.dashdot_pattern' : [4.8, 1.2, 0.8, 1.2],
# 'lines.dotted_pattern' : [1.1, 1.1],
# 'lines.scale_dashes': True}
def demo(ax, rcparams, title):
ax.axis('off')
ax.set_title(title)
with mpl.rc_context(rc=rcparams):
for j, sty in enumerate(sty_cycle):
ax.plot(x, y + j, **sty)
demo(ax1, classic, 'classic')
demo(ax2, {}, 'v2.0')