@@ -256,9 +256,68 @@ The following changes were made to the default behavior of
256
256
- the default linewidth change from 1 to 1.5
257
257
- the dash patterns associated with ``'--' ``, ``':' ``, and ``'-.' `` have
258
258
changed
259
- - the dash patterns now scale with line width.
259
+ - the dash patterns now scale with line width
260
260
261
261
262
+ .. plot ::
263
+
264
+ import numpy as np
265
+ import matplotlib.pyplot as plt
266
+ import matplotlib as mpl
267
+ from cycler import cycler
268
+
269
+ fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(6, 3))
270
+
271
+ N = 15
272
+
273
+ x = np.arange(N)
274
+ y = np.ones_like(x)
275
+
276
+ sty_cycle = (cycler('ls', ['--' ,':', '-.']) *
277
+ cycler('lw', [None, 1, 2, 5]))
278
+
279
+ classic = {
280
+ 'lines.linewidth': 1.0,
281
+ 'lines.dashed_pattern' : [6, 6],
282
+ 'lines.dashdot_pattern' : [3, 5, 1, 5],
283
+ 'lines.dotted_pattern' : [1, 3],
284
+ 'lines.scale_dashes': False}
285
+
286
+ v2 = {}
287
+ # {'lines.linewidth': 1.5,
288
+ # 'lines.dashed_pattern' : [2.8, 1.2],
289
+ # 'lines.dashdot_pattern' : [4.8, 1.2, 0.8, 1.2],
290
+ # 'lines.dotted_pattern' : [1.1, 1.1],
291
+ # 'lines.scale_dashes': True}
292
+
293
+ def demo(ax, rcparams, title):
294
+ ax.axis('off')
295
+ ax.set_title(title)
296
+ with mpl.rc_context(rc=rcparams):
297
+ for j, sty in enumerate(sty_cycle):
298
+ ax.plot(x, y + j, **sty)
299
+
300
+ demo(ax1, classic, 'classic')
301
+ demo(ax2, {}, 'v2.0')
302
+
303
+
304
+ The previous defaults can be restored by setting::
305
+
306
+ mpl.rcParams['lines.linewidth'] = 1.0
307
+ mpl.rcParams['lines.dashed_pattern'] = [6, 6]
308
+ mpl.rcParams['lines.dashdot_pattern'] = [3, 5, 1, 5]
309
+ mpl.rcParams['lines.dotted_pattern'] = [1, 3]
310
+ mpl.rcParams['lines.scale_dashes'] = False
311
+
312
+ or by setting::
313
+
314
+ lines.linewidth : 1.0
315
+ lines.dashed_pattern : 6, 6
316
+ lines.dashdot_pattern : 3, 5, 1, 5
317
+ lines.dotted_pattern : 1, 3
318
+ lines.scale_dashes: False
319
+
320
+ in your :file: `matplotlibrc ` file.
262
321
263
322
Other
264
323
=====
0 commit comments