diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index df4b27cdef18..e25f689eedbc 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -68,7 +68,7 @@ def _get_dash_pattern(style): def _scale_dashes(offset, dashes, lw): if rcParams['_internal.classic_mode']: return offset, dashes - scale = max(1.0, lw) + scale = max(2.0, lw) scaled_offset = scaled_dashes = None if offset is not None: scaled_offset = offset * scale diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index 8d2f642351e0..97413692496f 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -901,7 +901,7 @@ def validate_hist_bins(s): 'lines.solid_capstyle': ['projecting', validate_capstyle], 'lines.dashed_pattern': [[2.8, 1.2], validate_nseq_float()], 'lines.dashdot_pattern': [[4.8, 1.2, 0.8, 1.2], validate_nseq_float()], - 'lines.dotted_pattern': [[1.2, 0.6], validate_nseq_float()], + 'lines.dotted_pattern': [[1.1, 1.1], validate_nseq_float()], # marker props 'markers.fillstyle': ['full', validate_fillstyle], diff --git a/lib/matplotlib/tests/baseline_images/test_lines/scaled_lines.pdf b/lib/matplotlib/tests/baseline_images/test_lines/scaled_lines.pdf new file mode 100644 index 000000000000..c82443381bea Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_lines/scaled_lines.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_lines/scaled_lines.png b/lib/matplotlib/tests/baseline_images/test_lines/scaled_lines.png new file mode 100644 index 000000000000..f75601b67717 Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_lines/scaled_lines.png differ diff --git a/lib/matplotlib/tests/baseline_images/test_lines/scaled_lines.svg b/lib/matplotlib/tests/baseline_images/test_lines/scaled_lines.svg new file mode 100644 index 000000000000..c77f9edd7b51 --- /dev/null +++ b/lib/matplotlib/tests/baseline_images/test_lines/scaled_lines.svg @@ -0,0 +1,1989 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/matplotlib/tests/test_lines.py b/lib/matplotlib/tests/test_lines.py index 084a97b681fd..db0c839cd5ff 100644 --- a/lib/matplotlib/tests/test_lines.py +++ b/lib/matplotlib/tests/test_lines.py @@ -11,9 +11,12 @@ from nose.tools import assert_true, assert_raises from timeit import repeat import numpy as np +from cycler import cycler +import matplotlib import matplotlib.pyplot as plt from matplotlib.testing.decorators import cleanup, image_comparison + import sys @@ -178,13 +181,23 @@ def test_marker_fill_styles(): ax.set_xlim([-5, 135]) +@image_comparison(baseline_images=['scaled_lines'], style='default') +def test_lw_scaling(): + th = np.linspace(0, 32) + fig, ax = plt.subplots() + lins_styles = ['dashed', 'dotted', 'dashdot'] + cy = cycler(matplotlib.rcParams['axes.prop_cycle']) + for j, (ls, sty) in enumerate(zip(lins_styles, cy)): + for lw in np.linspace(.5, 10, 10): + ax.plot(th, j*np.ones(50) + .1 * lw, linestyle=ls, lw=lw, **sty) + + def test_nan_is_sorted(): - line = mlines.Line2D([],[]) + line = mlines.Line2D([], []) assert_true(line._is_sorted(np.array([1, 2, 3]))) assert_true(line._is_sorted(np.array([1, np.nan, 3]))) assert_true(not line._is_sorted([3, 5] + [np.nan] * 100 + [0, 2])) - if __name__ == '__main__': nose.runmodule(argv=['-s', '--with-doctest'], exit=False)